template struct mrpt::safe_ptr

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: public mrpt::safe_ptr_basic
{
    // construction

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

    //
methods

    safe_ptr& operator = (T* p);
    T& operator * ();
    const T& operator * () const;
    T& operator [] (size_t i);
    const T& operator [] (size_t i) const;
};

Inherited Members

public:
    //
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;