tlx
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 
16 namespace tlx {
17 
18 //! Simple method to free the underlying memory in a vector, because .clear()
19 //! need not do it.
20 template <typename Type>
21 void 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 swap(CountingPtr< A, D > &a1, CountingPtr< A, D > &a2) noexcept
swap enclosed object with another counting pointer (no reference counts need change) ...
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