PointerContainer.h
Go to the documentation of this file.
1 #ifndef _utl_PointerContainer_h_
2 #define _utl_PointerContainer_h_
3 
4 
5 namespace utl {
6 
7  namespace PointerContainer {
8 
9  template<typename T, class A, template<typename, typename> class V>
10  inline
11  void
12  Delete(V<T, A>& v)
13  {
14  for (const auto p : v)
15  delete p;
16  v.clear();
17  }
18 
19 
20  template<typename T, class A, template<typename, typename> class V>
21  inline
22  V<T, A>
23  DeepCopy(const V<T, A>& a)
24  {
25  V<T, A> b;
26  b.reserve(a.size());
27  for (const auto p : a)
28  b.push_back(new T(*p));
29  return b;
30  }
31 
32  }
33 
34 }
35 
36 
37 #endif
constexpr double V
Definition: AugerUnits.h:233
V< T, A > DeepCopy(const V< T, A > &a)
void Delete(V< T, A > &v)

, generated on Tue Sep 26 2023.