tlx
Loading...
Searching...
No Matches
vector_free.hpp
Go to the documentation of this file.
1/*******************************************************************************
2 * tlx/vector_free.hpp
3 *
4 * Part of tlx - http://panthema.net/tlx
5 *
6 * Copyright (C) 2019 Timo Bingmann <tb@panthema.net>
7 *
8 * All rights reserved. Published under the Boost Software License, Version 1.0
9 ******************************************************************************/
10
11#ifndef TLX_VECTOR_FREE_HEADER
12#define TLX_VECTOR_FREE_HEADER
13
14#include <vector>
15
16namespace tlx {
17
18//! Simple method to free the underlying memory in a vector, because .clear()
19//! need not do it.
20template <typename Type>
21void vector_free(std::vector<Type>& v) {
22 std::vector<Type>().swap(v);
23}
24
25} // namespace tlx
26
27#endif // !TLX_VECTOR_FREE_HEADER
28
29/******************************************************************************/
void vector_free(std::vector< Type > &v)
Simple method to free the underlying memory in a vector, because .clear() need not do it.
Definition: vector_free.hpp:21