template struct mrpt::non_copiable_ptr

A wrapper class for pointers that can NOT be copied with “=” operator, raising an exception at runtime if a copy is attempted.

See also:

safe_ptr, non_copiable_ptr, copiable_NULL_ptr

#include <mrpt/core/safe_pointers.h>

template <class T>
struct non_copiable_ptr: public mrpt::non_copiable_ptr_basic
{
    // construction

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

    //
methods

    non_copiable_ptr<T>& operator = (const T* p);
    non_copiable_ptr<T>& operator = (const non_copiable_ptr<T>&);
    T& operator * ();
    const T& operator * () const;
    T& operator [] (size_t i);
    const T& operator [] (size_t i) const;
    void set(const T* p);
};

Inherited Members

public:
    //
methods

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

Methods

void set(const T* p)

This method can change the pointer, since the change is made explicitly, not through copy operators transparent to the user.