queso-0.57.1
|
Definition of a scoped pointer. More...
#include <ScopedPtr.h>
Definition of a scoped pointer.
Scoped pointers are smart pointers that clean up after themselves when they go out of scope, with no shared ownership, and with no transfer of ownership regardless of the underlying implementation.
If QUESO detects C++11 functionality at configure-time, then the underlying implementation of ScopedPtr is that of std::unique_ptr. Even when this is the case, please note that shared ownership and transfer of ownership are not supported.
If QUESO does not detect C++11 functionality then QUESO will check if boost is present and, if so, will use boost::scoped_ptr as the underlying implementation. It should now be clear why shared ownership and transfer of ownership are not permitted.
If QUESO fails to detect both C++11 functionality and boost then QUESO's last resort is to fall back on the C++03's std::auto_ptr. If std::auto_ptr isn't detected, QUESO will fail to configure.
ScopedPtr is implemented as a template typedef pattern. That is, one declares a ScopedPtr like so:
QUESO::ScopedPtr< name_of_type >::Type name_of_variable;