Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
CLHEP::shared_ptr< P > Class Template Reference

#include <memory.h>

Public Types

typedef P element_type
 

Public Member Functions

 shared_ptr () throw ()
 
template<typename P2 >
 shared_ptr (P2 *)
 
template<typename P2 , typename D >
 shared_ptr (P2 *, D)
 
template<typename P2 , typename D , typename A >
 shared_ptr (P2 *, D, A)
 
void swap (shared_ptr< P > &) throw ()
 
shared_ptroperator= (shared_ptr const &) throw ()
 
template<typename P2 >
 shared_ptr (weak_ptr< P2 > const &)
 
template<typename P2 >
 shared_ptr (weak_ptr< P2 > const &, sp::sp_nothrow_tag) throw ()
 
template<typename P2 >
 shared_ptr (shared_ptr< P2 > const &, P *) throw ()
 
template<typename P2 >
 shared_ptr (shared_ptr< P2 > const &, sp::static_cast_tag)
 
template<typename P2 >
 shared_ptr (shared_ptr< P2 > const &, sp::const_cast_tag)
 
template<typename P2 >
 shared_ptr (shared_ptr< P2 > const &, sp::dynamic_cast_tag)
 
template<typename P2 >
 shared_ptr (shared_ptr< P2 > const &, sp::polymorphic_cast_tag)
 
template<typename P2 >
 shared_ptr (std::auto_ptr< P2 > &)
 
template<typename AP >
 shared_ptr (AP, typename enable_if_auto_ptr< AP, void * >::type=0)
 
template<typename P2 >
 shared_ptr (shared_ptr< P2 > const &, typename enable_if_ptr_convertible< P2, P, void * >::type=0) throw ()
 
template<typename P2 >
shared_ptroperator= (shared_ptr< P2 > const &) throw ()
 
template<typename P2 >
shared_ptroperator= (std::auto_ptr< P2 > &)
 
template<typename AP >
enable_if_auto_ptr< AP, shared_ptr & >::type operator= (AP)
 
void reset () throw ()
 
template<typename P2 >
void reset (P2 *)
 
template<typename P2 , typename D >
void reset (P2 *, D)
 
template<typename P2 , typename D , typename A >
void reset (P2 *, D, A)
 
template<typename P2 >
void reset (shared_ptr< P2 > const &, P *)
 
 operator bool () const throw ()
 
reference operator* () const throw ()
 
P * operator-> () const throw ()
 
P * get () const throw ()
 
bool unique () const throw ()
 
long use_count () const throw ()
 
template<typename P2 >
bool _internal_less (shared_ptr< P2 > const &) const
 
void * _internal_get_deleter (std::type_info const &) const
 
bool _internal_equiv (shared_ptr const &) const
 
template<typename P2 >
shared_ptr< P > & operator= (shared_ptr< P2 > const &other) throw ()
 
template<typename P2 >
shared_ptr< P > & operator= (std::auto_ptr< P2 > &other)
 

Friends

template<typename >
class shared_ptr
 
template<typename >
class weak_ptr
 

Detailed Description

template<typename P>
class CLHEP::shared_ptr< P >

Definition at line 814 of file memory.h.

Member Typedef Documentation

◆ element_type

template<typename P >
typedef P CLHEP::shared_ptr< P >::element_type

Definition at line 823 of file memory.h.

Constructor & Destructor Documentation

◆ shared_ptr() [1/14]

template<typename P >
CLHEP::shared_ptr< P >::shared_ptr
throw (
)

Definition at line 938 of file memory.h.

939 : px( 0 )
940 , pn( )
941{ }

◆ shared_ptr() [2/14]

template<typename P >
template<typename P2 >
CLHEP::shared_ptr< P >::shared_ptr ( P2 *  p)
inlineexplicit

Definition at line 945 of file memory.h.

946 : px( p )
947 , pn( p )
948{
949 sp::sp_enable_shared_from_this( this, p, p );
950}
void sp_enable_shared_from_this(shared_ptr< X > const *ppx, Y const *py, enable_shared_from_this< T > const *pe)
Definition: memory.h:782

◆ shared_ptr() [3/14]

template<typename P >
template<typename P2 , typename D >
CLHEP::shared_ptr< P >::shared_ptr ( P2 *  p,
d 
)
inline

Definition at line 954 of file memory.h.

955 : px( p )
956 , pn( p, d )
957{
958 sp::sp_enable_shared_from_this( this, p, p );
959}

◆ shared_ptr() [4/14]

template<typename P >
template<typename P2 , typename D , typename A >
CLHEP::shared_ptr< P >::shared_ptr ( P2 *  p,
d,
a 
)
inline

Definition at line 963 of file memory.h.

964 : px( p )
965 , pn( p, d, a )
966{
967 sp::sp_enable_shared_from_this( this, p, p );
968}

◆ shared_ptr() [5/14]

template<typename P >
template<typename P2 >
CLHEP::shared_ptr< P >::shared_ptr ( weak_ptr< P2 > const other)
inlineexplicit

Definition at line 988 of file memory.h.

989 : px( 0 ) // temporarily
990 , pn( other.pn ) // may throw
991{
992 px = other.px; // safe to copy other.px, as pn(other.pn) did not throw
993}

◆ shared_ptr() [6/14]

template<typename P >
template<typename P2 >
CLHEP::shared_ptr< P >::shared_ptr ( weak_ptr< P2 > const other,
sp::sp_nothrow_tag   
)
throw (
)
inline

Definition at line 997 of file memory.h.

1000 : px( 0 ) // temporarily
1001 , pn( other.pn, sp::sp_nothrow_tag() )
1002{
1003 if( ! pn.empty() )
1004 px = other.px;
1005}

◆ shared_ptr() [7/14]

template<typename P >
template<typename P2 >
CLHEP::shared_ptr< P >::shared_ptr ( shared_ptr< P2 > const other,
P *  p 
)
throw (
)
inline

Definition at line 1009 of file memory.h.

1012 : px( p )
1013 , pn( other.pn )
1014{ }

◆ shared_ptr() [8/14]

template<typename P >
template<typename P2 >
CLHEP::shared_ptr< P >::shared_ptr ( shared_ptr< P2 > const other,
sp::static_cast_tag   
)
inline

Definition at line 1018 of file memory.h.

1021 : px( static_cast<element_type*>( other.px ) )
1022 , pn( other.pn )
1023{ }

◆ shared_ptr() [9/14]

template<typename P >
template<typename P2 >
CLHEP::shared_ptr< P >::shared_ptr ( shared_ptr< P2 > const other,
sp::const_cast_tag   
)
inline

Definition at line 1027 of file memory.h.

1030 : px( const_cast<element_type*>( other.px ) )
1031 , pn( other.pn )
1032{ }

◆ shared_ptr() [10/14]

template<typename P >
template<typename P2 >
CLHEP::shared_ptr< P >::shared_ptr ( shared_ptr< P2 > const other,
sp::dynamic_cast_tag   
)
inline

Definition at line 1036 of file memory.h.

1039 : px( dynamic_cast<element_type*>( other.px ) )
1040 , pn( other.pn )
1041{
1042 if( px == 0 ) // cast failed?
1043 pn = sp::shared_ctrl_handle(); // yes; need our own control information
1044}

◆ shared_ptr() [11/14]

template<typename P >
template<typename P2 >
CLHEP::shared_ptr< P >::shared_ptr ( shared_ptr< P2 > const other,
sp::polymorphic_cast_tag   
)
inline

Definition at line 1048 of file memory.h.

1051 : px( dynamic_cast<element_type*>( other.px ) )
1052 , pn( other.pn )
1053{
1054 if( px == 0 )
1055 throw std::bad_cast();
1056}

◆ shared_ptr() [12/14]

template<typename P >
template<typename P2 >
CLHEP::shared_ptr< P >::shared_ptr ( std::auto_ptr< P2 > &  other)
inlineexplicit

Definition at line 1060 of file memory.h.

1061 : px( other.get() )
1062 , pn( ) // temporarily
1063{
1064 P2 * tmp = other.get();
1065 pn = sp::shared_ctrl_handle( other );
1066 sp::sp_enable_shared_from_this( this, tmp, tmp );
1067}

◆ shared_ptr() [13/14]

template<typename P >
template<typename AP >
CLHEP::shared_ptr< P >::shared_ptr ( AP  other,
typename enable_if_auto_ptr< AP, void * >::type  = 0 
)
inlineexplicit

Definition at line 1071 of file memory.h.

1074 : px( other.get() )
1075 , pn( ) // temporarily
1076{
1077 typename AP::element_type * tmp = other.get();
1078 pn = sp::shared_ctrl_handle( other );
1079 sp::sp_enable_shared_from_this( this, tmp, tmp );
1080}

◆ shared_ptr() [14/14]

template<typename P >
template<typename P2 >
CLHEP::shared_ptr< P >::shared_ptr ( shared_ptr< P2 > const other,
typename enable_if_ptr_convertible< P2, P, void * >::type  = 0 
)
throw (
)
inline

Definition at line 1084 of file memory.h.

1087 : px( other.px )
1088 , pn( other.pn )
1089 { }

Member Function Documentation

◆ _internal_equiv()

template<typename P >
bool CLHEP::shared_ptr< P >::_internal_equiv ( shared_ptr< P > const other) const
inline

Definition at line 1219 of file memory.h.

1220{
1221 return px == other.px && pn == other.pn;
1222}

◆ _internal_get_deleter()

template<typename P >
void * CLHEP::shared_ptr< P >::_internal_get_deleter ( std::type_info const ti) const
inline

Definition at line 1212 of file memory.h.

1213{
1214 return pn.get_deleter( ti );
1215}
void * get_deleter(std::type_info const &) const
Definition: memory.h:558

Referenced by CLHEP::get_deleter().

◆ _internal_less()

template<typename P >
template<typename P2 >
bool CLHEP::shared_ptr< P >::_internal_less ( shared_ptr< P2 > const rhs) const
inline

Definition at line 1205 of file memory.h.

1206{
1207 return pn < rhs.pn;
1208}

Referenced by CLHEP::operator<().

◆ get()

template<typename P >
P * CLHEP::shared_ptr< P >::get
throw (
)
inline

◆ operator bool()

template<typename P >
CLHEP::shared_ptr< P >::operator bool
throw (
)
inline

Definition at line 1159 of file memory.h.

1160{
1161 return px;
1162}

◆ operator*()

template<typename P >
sp::shared_ptr_traits< P >::reference CLHEP::shared_ptr< P >::operator*
throw (
)
inline

Definition at line 1167 of file memory.h.

1168{
1169 assert( px != 0 );
1170 return *px;
1171}

◆ operator->()

template<typename P >
P * CLHEP::shared_ptr< P >::operator->
throw (
)
inline

Definition at line 1175 of file memory.h.

1176{
1177 assert( px != 0 );
1178 return px;
1179}

◆ operator=() [1/6]

template<typename P >
template<typename AP >
enable_if_auto_ptr< AP, shared_ptr< P > & >::type CLHEP::shared_ptr< P >::operator= ( AP  other)
inline

Definition at line 1112 of file memory.h.

1113{
1114 this_type( other ).swap( *this );
1115 return *this;
1116}

◆ operator=() [2/6]

template<typename P >
shared_ptr< P > & CLHEP::shared_ptr< P >::operator= ( shared_ptr< P > const other)
throw (
)
inline

Definition at line 980 of file memory.h.

981{
982 this_type( other ).swap( *this );
983 return *this;
984}

◆ operator=() [3/6]

template<typename P >
template<typename P2 >
shared_ptr & CLHEP::shared_ptr< P >::operator= ( shared_ptr< P2 > const )
throw (
)
inline

◆ operator=() [4/6]

template<typename P >
template<typename P2 >
shared_ptr< P > & CLHEP::shared_ptr< P >::operator= ( shared_ptr< P2 > const other)
throw (
)

Definition at line 1094 of file memory.h.

1095{
1096 this_type( other ).swap( *this );
1097 return *this;
1098}

◆ operator=() [5/6]

template<typename P >
template<typename P2 >
shared_ptr & CLHEP::shared_ptr< P >::operator= ( std::auto_ptr< P2 > &  )
inline

◆ operator=() [6/6]

template<typename P >
template<typename P2 >
shared_ptr< P > & CLHEP::shared_ptr< P >::operator= ( std::auto_ptr< P2 > &  other)

Definition at line 1103 of file memory.h.

1104{
1105 this_type( other ).swap( *this );
1106 return *this;
1107}

◆ reset() [1/5]

template<typename P >
void CLHEP::shared_ptr< P >::reset
throw (
)
inline

Definition at line 1120 of file memory.h.

1121{
1122 this_type().swap( *this );
1123}

◆ reset() [2/5]

template<typename P >
template<typename P2 >
void CLHEP::shared_ptr< P >::reset ( P2 *  p)
inline

Definition at line 1128 of file memory.h.

1129{
1130 assert( p == 0 || p != px ); // oughtn't reset oneself
1131 this_type( p ).swap( *this );
1132}

◆ reset() [3/5]

template<typename P >
template<typename P2 , typename D >
void CLHEP::shared_ptr< P >::reset ( P2 *  p,
d 
)
inline

Definition at line 1137 of file memory.h.

1138{
1139 this_type( p, d ).swap( *this );
1140}

◆ reset() [4/5]

template<typename P >
template<typename P2 , typename D , typename A >
void CLHEP::shared_ptr< P >::reset ( P2 *  p,
d,
a 
)
inline

Definition at line 1145 of file memory.h.

1146{
1147 this_type( p, d, a ).swap( *this );
1148}

◆ reset() [5/5]

template<typename P >
template<typename P2 >
void CLHEP::shared_ptr< P >::reset ( shared_ptr< P2 > const other,
P *  p 
)
inline

Definition at line 1153 of file memory.h.

1154{
1155 this_type( other, p ).swap( *this );
1156}

◆ swap()

template<typename P >
void CLHEP::shared_ptr< P >::swap ( shared_ptr< P > &  other)
throw (
)
inline

Definition at line 972 of file memory.h.

973{
974 std::swap( px, other.px );
975 pn.swap( other.pn );
976}
void swap(shared_ctrl_handle &)
Definition: memory.h:528

Referenced by CLHEP::shared_ptr< P >::operator=(), CLHEP::shared_ptr< P >::reset(), and CLHEP::swap().

◆ unique()

template<typename P >
bool CLHEP::shared_ptr< P >::unique
throw (
)
inline

Definition at line 1190 of file memory.h.

1191{
1192 return pn.unique();
1193}

◆ use_count()

template<typename P >
long CLHEP::shared_ptr< P >::use_count
throw (
)
inline

Definition at line 1197 of file memory.h.

1198{
1199 return pn.use_count();
1200}

Friends And Related Function Documentation

◆ shared_ptr

template<typename P >
template<typename >
friend class shared_ptr
friend

Definition at line 819 of file memory.h.

◆ weak_ptr

template<typename P >
template<typename >
friend class weak_ptr
friend

Definition at line 820 of file memory.h.


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