28 if (!o)
return nullptr;
38 if (!o)
return nullptr;
39 T*
n =
dynamic_cast<T*
>(o->clone());
41 throw std::runtime_error(
"error: clone() returned unexpected type");
46 template <
typename T,
typename Copier>
75 if (
this == &o)
return *
this;
85 if (
this == &o)
return *
this;
96 throw std::runtime_error(
"dereferencing nullptr poly_ptr");
103 throw std::runtime_error(
"dereferencing nullptr poly_ptr");
111 throw std::runtime_error(
"dereferencing nullptr poly_ptr");
118 throw std::runtime_error(
"dereferencing nullptr poly_ptr");
122 const T*
get()
const {
return m_ptr; }
123 operator bool()
const {
return m_ptr !=
nullptr; }
135 if (ptr ==
m_ptr)
return;
152 template <
typename T>
160 template <
typename T>
generic_copier_ptr(generic_copier_ptr< T, Copier > &&o)
move ctor
generic_copier_ptr< T, Copier > & operator=(const generic_copier_ptr< T, Copier > &o)
copy operator
generic_copier_ptr(const generic_copier_ptr< T, Copier > &o)
copy ctor: makes a copy of the object via clone()
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
generic_copier_ptr< T, Copier > & operator=(generic_copier_ptr< T, Copier > &&o)
move operator
GLdouble GLdouble GLdouble r
const T & operator*() const
const T * operator->() const
T * release()
Releases the pointer (do not destroy the object)
generic_copier_ptr()
Default ctor; init to nullptr.
generic_copier_ptr(T *ptr)
Ctor from a pointer; takes ownership.
void reset(T *ptr=nullptr)