StreamerUtilities.h
Go to the documentation of this file.
1 #ifndef _io_StreamerUtilities_h_
2 #define _io_StreamerUtilities_h_
3 
4 #include <vector>
5 
6 
7 namespace io {
8 
9  template<class T, class U>
10  inline
11  void
12  ConvertCopy(T*& destination, const U& source)
13  {
14  delete destination;
15  destination = new T(source);
16  }
17 
18 
19  template<class T, class U>
20  inline
21  void
22  DeepCopy(T*& destination, U* const source)
23  {
24  delete destination;
25  destination = source ? new T(*source) : nullptr;
26  }
27 
28 
29  template<typename T1, class A1, typename T2, class A2>
30  inline
31  void
32  Convert(std::vector<T1, A1>& destination, const std::vector<T2, A2>& source)
33  {
34  destination.clear();
35  destination.assign(source.begin(), source.end());
36  }
37 
38 
39  template<typename T1, typename U1, class A1, typename T2, typename U2, class A2>
40  inline
41  void
42  Convert(std::map<T1, U1, A1>& destination, const std::map<T2, U2, A2>& source)
43  {
44  destination.clear();
45  destination.insert(source.begin(), source.end());
46  }
47 
48 }
49 
50 
51 #endif
void Convert(std::vector< T1, A1 > &destination, const std::vector< T2, A2 > &source)
void ConvertCopy(T *&destination, const U &source)
#define U
void DeepCopy(T *&destination, U *const source)

, generated on Tue Sep 26 2023.