ATLAS Offline Software
unique_clone.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 namespace Trk{
6  //Produces a unique_ptr clone from a bare pointer to object with a 'clone' method
7  template<typename T>
8  std::unique_ptr<T> unique_clone(const T * v) {
9  if (v != nullptr) {
10  return std::unique_ptr<T>(v->clone());
11  } else {
12  return nullptr;
13  }
14  }
15 
16  //Produces a unique_ptr clone from a unique_ptr to object with a 'clone' method
17  template<typename T>
18  std::unique_ptr<T> unique_clone(const std::unique_ptr<T> & v) {
19  if (v != nullptr) {
20  return std::unique_ptr<T>(v->clone());
21  } else {
22  return nullptr;
23  }
24  }
25 }
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::unique_clone
std::unique_ptr< T > unique_clone(const T *v)
Definition: unique_clone.h:8
Trk::v
@ v
Definition: ParamDefs.h:78