Teuchos - Trilinos Tools Package
Version of the Day
|
Class Handleable provides an abstract interface for polymorphic conversion from raw pointers to smart pointers. More...
#include <Teuchos_Handleable.hpp>
Public Member Functions | |
virtual | ~Handleable () |
virtual RCP< Base > | getRcp ()=0 |
Return a safely-created RCP to the base type. More... | |
Public Member Functions inherited from Teuchos::ConstHandleable< Base > | |
virtual | ~ConstHandleable () |
virtual RCP< const Base > | getConstRcp () const =0 |
Virtual dtorReturn a safely-created RCP to the base type. More... | |
Class Handleable provides an abstract interface for polymorphic conversion from raw pointers to smart pointers.
Recall from the Teuchos RCP documentation that one should never create directly a smart pointer from a raw pointer; rather, smart pointers should be created through a call to rcp(). The type of the argument to rcp() must be known at compile time. This makes the syntax
impossible with the straightforward implementation in which Handle takes a raw pointer to a Base. In order to preserve this clean syntax, we require any handles supporting this syntax to take a raw pointer to a Handleable<Base>, where Handleable<Base> provides a getRcp() method which returns the result of a call to rcp() on this.
Definition at line 60 of file Teuchos_Handleable.hpp.
|
inlinevirtual |
Definition at line 65 of file Teuchos_Handleable.hpp.
|
pure virtual |
Return a safely-created RCP to the base type.