File indexing completed on 2025-01-18 09:55:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef DD4HEP_MEMORY_H
0015 #define DD4HEP_MEMORY_H
0016
0017
0018 #include <RVersion.h>
0019
0020 #ifdef __GNUC__
0021 #pragma GCC diagnostic push
0022 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0023 #elif defined(__llvm__) || defined(__APPLE__)
0024 #pragma clang diagnostic push
0025 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
0026 #endif
0027
0028
0029
0030 #include <memory>
0031
0032
0033
0034 namespace dd4hep {
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 template <typename T> class dd4hep_ptr
0046 : public std::unique_ptr<T> {
0047 public:
0048 typedef std::unique_ptr<T> base_t;
0049 public:
0050
0051 dd4hep_ptr() : base_t() {}
0052
0053 dd4hep_ptr(T* p) : base_t(p) {}
0054
0055 dd4hep_ptr(base_t& c) : base_t(c) {}
0056
0057 dd4hep_ptr& operator=(base_t& c) {
0058 if ( this != &c ) {
0059 this->swap(c);
0060 }
0061 return *this;
0062 }
0063
0064 dd4hep_ptr& adopt(T* ptr) {
0065 base_t smart_ptr(ptr);
0066 this->swap(smart_ptr);
0067 return *this;
0068 }
0069 };
0070 }
0071
0072 #ifdef __GNUC__
0073 #pragma GCC diagnostic pop
0074 #elif defined(__llvm__) || defined(__APPLE__)
0075 #pragma clang diagnostic pop
0076 #endif
0077
0078 #endif