39 T*
n =
dynamic_cast<T*
>(o->clone());
40 if (!
n)
throw std::runtime_error(
"error: clone() returned unexpected type");
45 template <
typename T,
typename Copier >
63 #if (__cplusplus>199711L) 70 generic_copier_ptr<T, Copier> &operator =(
const generic_copier_ptr<T, Copier> && o) {
71 if (
this == &o)
return *
this;
80 else throw std::runtime_error(
"dereferencing NULL generic_copier_ptr");
84 else throw std::runtime_error(
"dereferencing NULL generic_copier_ptr");
89 else throw std::runtime_error(
"dereferencing NULL generic_copier_ptr");
93 else throw std::runtime_error(
"dereferencing NULL generic_copier_ptr");
97 const T *
get()
const {
return m_ptr; }
99 operator bool()
const {
return m_ptr != NULL; }
110 if (ptr ==
m_ptr)
return;
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.
const T & operator*(void) const
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLdouble GLdouble GLdouble r
T * release()
Releases the pointer (do not destroy the object)
generic_copier_ptr(T *ptr)
Ctor from a pointer; takes ownership.
const T * operator->() const