LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
llvm::polymorphic_ptr< T > Class Template Reference

An owning, copyable polymorphic smart pointer. More...

#include <polymorphic_ptr.h>

Public Member Functions

 polymorphic_ptr (T *ptr=0)
 
 polymorphic_ptr (const polymorphic_ptr &arg)
 
 ~polymorphic_ptr ()
 
polymorphic_ptroperator= (polymorphic_ptr arg)
 
polymorphic_ptroperator= (T *arg)
 
Toperator* () const
 
Toperator-> () const
 
LLVM_EXPLICIT operator bool () const
 
bool operator! () const
 
Tget () const
 
Ttake ()
 
void swap (polymorphic_ptr &arg)
 

Detailed Description

template<typename T>
class llvm::polymorphic_ptr< T >

An owning, copyable polymorphic smart pointer.

This pointer exists to provide copyable owned smart pointer. Rather than shared ownership semantics, it has unique ownership semantics and deep copy semantics. It is copyable by requiring that the underlying type exposes a method which can produce a (heap allocated) clone.

Note that in almost all scenarios use of this could be avoided if we could build move-only containers of a std::unique_ptr, but until then this provides an effective way to place polymorphic objects in a container.

Definition at line 37 of file polymorphic_ptr.h.

Constructor & Destructor Documentation

template<typename T>
llvm::polymorphic_ptr< T >::polymorphic_ptr ( T ptr = 0)
inline

Definition at line 41 of file polymorphic_ptr.h.

template<typename T>
llvm::polymorphic_ptr< T >::polymorphic_ptr ( const polymorphic_ptr< T > &  arg)
inline

Definition at line 42 of file polymorphic_ptr.h.

template<typename T>
llvm::polymorphic_ptr< T >::~polymorphic_ptr ( )
inline

Definition at line 46 of file polymorphic_ptr.h.

Member Function Documentation

template<typename T>
T* llvm::polymorphic_ptr< T >::get ( ) const
inline

Definition at line 65 of file polymorphic_ptr.h.

Referenced by llvm::operator!=(), and llvm::operator==().

template<typename T>
LLVM_EXPLICIT llvm::polymorphic_ptr< T >::operator bool ( ) const
inline

Definition at line 62 of file polymorphic_ptr.h.

template<typename T>
bool llvm::polymorphic_ptr< T >::operator! ( ) const
inline

Definition at line 63 of file polymorphic_ptr.h.

template<typename T>
T& llvm::polymorphic_ptr< T >::operator* ( ) const
inline

Definition at line 60 of file polymorphic_ptr.h.

template<typename T>
T* llvm::polymorphic_ptr< T >::operator-> ( ) const
inline

Definition at line 61 of file polymorphic_ptr.h.

template<typename T>
polymorphic_ptr& llvm::polymorphic_ptr< T >::operator= ( polymorphic_ptr< T arg)
inline

Definition at line 48 of file polymorphic_ptr.h.

References llvm::polymorphic_ptr< T >::swap().

template<typename T>
polymorphic_ptr& llvm::polymorphic_ptr< T >::operator= ( T arg)
inline

Definition at line 52 of file polymorphic_ptr.h.

template<typename T>
void llvm::polymorphic_ptr< T >::swap ( polymorphic_ptr< T > &  arg)
inline

Definition at line 73 of file polymorphic_ptr.h.

Referenced by llvm::polymorphic_ptr< T >::operator=(), and llvm::swap().

template<typename T>
T* llvm::polymorphic_ptr< T >::take ( )
inline

Definition at line 67 of file polymorphic_ptr.h.


The documentation for this class was generated from the following file: