ATLAS Offline Software
Loading...
Searching...
No Matches
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
5namespace 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}
Ensure that the ATLAS eigen extensions are properly loaded.
std::unique_ptr< T > unique_clone(const T *v)
Definition unique_clone.h:8
@ v
Definition ParamDefs.h:78