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>
80 if (
this == &o)
return *
this;
90 if (
this == &o)
return *
this;
101 throw std::runtime_error(
"dereferencing nullptr poly_ptr");
108 throw std::runtime_error(
"dereferencing nullptr poly_ptr");
116 throw std::runtime_error(
"dereferencing nullptr poly_ptr");
123 throw std::runtime_error(
"dereferencing nullptr poly_ptr");
127 const T*
get()
const {
return m_ptr; }
128 operator bool()
const {
return m_ptr !=
nullptr; }
140 if (ptr ==
m_ptr)
return;
156 template <
typename T>
164 template <
typename T>
bool operator!(void) const
void move_from(generic_copier_ptr &o)
generic_copier_ptr(const generic_copier_ptr< T, Copier > &o)
copy ctor: makes a copy of the object via clone()
generic_copier_ptr()
Default ctor; init to nullptr.
generic_copier_ptr< T, Copier > & operator=(generic_copier_ptr< T, Copier > &&o)
move operator
const T & operator*(void) const
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLdouble GLdouble GLdouble r
generic_copier_ptr(generic_copier_ptr< T, Copier > &&o)
move ctor
T * release()
Releases the pointer (do not destroy the object)
generic_copier_ptr(T *ptr)
Ctor from a pointer; takes ownership.
void reset(T *ptr=nullptr)
generic_copier_ptr< T, Copier > & operator=(const generic_copier_ptr< T, Copier > &o)
copy operator
const T * operator->() const