template struct mrpt::safe_ptr_basic

A wrapper class for pointers that can be safely copied with “=” operator without problems.

This class does not keep any reference count nor automatically destroy the pointed data.

See also:

safe_ptr, non_copiable_ptr, copiable_NULL_ptr

#include <mrpt/core/safe_pointers.h>

template <class T>
struct safe_ptr_basic
{
    // construction

    safe_ptr_basic();
    safe_ptr_basic(const safe_ptr_basic<T>& o);
    safe_ptr_basic(const T* p);

    //
methods

    safe_ptr_basic<T>& operator = (T* p);
    safe_ptr_basic<T>& operator = (const safe_ptr_basic<T>& o);
    bool operator == (const T* o) const;
    bool operator == (const safe_ptr_basic<T>& o) const;
    bool operator != (const T* o) const;
    bool operator != (const safe_ptr_basic<T>& o) const;
    T*& get();
    const T* get() const;
    T*& operator -> ();
    const T* operator -> () const;
};

// direct descendants

template <class T>
struct safe_ptr;