|
constexpr | ProPtr () noexcept |
| Default constructor.
|
|
constexpr | ProPtr (std::nullptr_t) noexcept |
| Construct from nullptr_t.
|
|
| ProPtr (pointer p, bool own=false) noexcept |
| Construct from pointer. More...
|
|
| ProPtr (const ProPtr &pro)=delete |
| Non-copyable.
|
|
| ProPtr (ProPtr &&pro) noexcept |
| Move constructor.
|
|
template<typename U > |
| ProPtr (ProPtr< U > &&pro) noexcept |
| Move construct from a derived type.
|
|
| ~ProPtr () |
| Desctructor. More...
|
|
ProPtr & | operator= (const ProPtr &pro)=delete |
| Non-copyable.
|
|
ProPtr & | operator= (std::nullptr_t) noexcept |
| Copy assignment from nullptr. More...
|
|
ProPtr & | operator= (ProPtr &&pro) noexcept |
| Move assignment operator.
|
|
template<typename U > |
ProPtr & | operator= (ProPtr< U > &&pro) noexcept |
| Move assignment from a derived type.
|
|
pointer | release () noexcept |
| Release the ownership(if owns) and return the data.
|
|
void | reset (pointer p=pointer(), bool own=false) noexcept |
| Reset the ProPtr. More...
|
|
void | swap (ProPtr &pro) noexcept |
| Swap this ProPtr with another, both resource and ownership.
|
|
pointer | get () const noexcept |
| Get the underlying resource.
|
|
| operator bool () const noexcept |
| Return true if resource is valid.
|
|
std::add_lvalue_reference< T >::type | operator* () const |
| Return the data being pointed to.
|
|
pointer | operator-> () const noexcept |
| Return the raw pointer.
|
|
bool | owns () const noexcept |
| Return whether this pointer owns the resource.
|
|
template<typename T>
class Euclid::ProPtr< T >
This class wraps up raw pointers who might or might not own the underlying resource. The motivation of this design is that when constructing complex algorithms one may need to use a lot of components, and some of them may share commonn internal computations. So it's desired that they are computed once and used everywhere as long as the user kept the underlying resource valid. This class will automatically manage the resource in one place and free the data when it goes out of scope.