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

#include <memory.h>

Public Types

typedef P element_type
 

Public Member Functions

 weak_ptr () throw ()
 
void swap (this_type &other) throw ()
 
template<typename P2 >
 weak_ptr (weak_ptr< P2 > const &r, typename enable_if_ptr_convertible< P2, P, void * >::type=0) throw ()
 
template<typename P2 >
 weak_ptr (shared_ptr< P2 > const &r, typename enable_if_ptr_convertible< P2, P, void * >::type=0) throw ()
 
template<typename P2 >
weak_ptroperator= (weak_ptr< P2 > const &r) throw ()
 
template<typename P2 >
weak_ptroperator= (shared_ptr< P2 > const &r) throw ()
 
shared_ptr< P > lock () const throw ()
 
long use_count () const throw ()
 
bool expired () const throw ()
 
bool _empty () const
 
void reset () throw ()
 
void _internal_assign (P *px2, sp::shared_ctrl_handle const &pn2)
 
template<typename P2 >
bool _internal_less (weak_ptr< P2 > const &rhs) const
 
template<typename P2 >
weak_ptr< P > & operator= (weak_ptr< P2 > const &r) throw ()
 
template<typename P2 >
weak_ptr< P > & operator= (shared_ptr< P2 > const &r) throw ()
 

Friends

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

Detailed Description

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

Definition at line 1301 of file memory.h.

Member Typedef Documentation

◆ element_type

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

Definition at line 1309 of file memory.h.

Constructor & Destructor Documentation

◆ weak_ptr() [1/3]

template<typename P >
CLHEP::weak_ptr< P >::weak_ptr
throw (
)
inline

Definition at line 1356 of file memory.h.

1357 : px( 0 )
1358 , pn( )
1359{ }

◆ weak_ptr() [2/3]

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

Definition at line 1363 of file memory.h.

1366 : px( r.lock().get() ) // same as r.px, but doesn't risk invalidation
1367 , pn( r.pn )
1368{ }

◆ weak_ptr() [3/3]

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

Definition at line 1372 of file memory.h.

1375 : px( r.px )
1376 , pn( r.pn )
1377{ }

Member Function Documentation

◆ _empty()

template<typename P >
bool CLHEP::weak_ptr< P >::_empty
inline

Definition at line 1422 of file memory.h.

1423{
1424 return pn.empty();
1425}

◆ _internal_assign()

template<typename P >
void CLHEP::weak_ptr< P >::_internal_assign ( P *  px2,
sp::shared_ctrl_handle const pn2 
)
inline

Definition at line 1444 of file memory.h.

1445{
1446 px = px2;
1447 pn = pn2;
1448}

◆ _internal_less()

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

Definition at line 1453 of file memory.h.

1454{
1455 return pn < rhs.pn;
1456}

Referenced by CLHEP::operator<().

◆ expired()

template<typename P >
bool CLHEP::weak_ptr< P >::expired
throw (
)
inline

Definition at line 1415 of file memory.h.

1416{
1417 return pn.use_count() == 0;
1418}
long use_count() const
Definition: memory.h:698

◆ lock()

template<typename P >
shared_ptr< P > CLHEP::weak_ptr< P >::lock
throw (
)
inline

Definition at line 1401 of file memory.h.

1402{
1403 return shared_ptr<element_type>( *this, sp::sp_nothrow_tag() );
1404}

◆ operator=() [1/4]

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

◆ operator=() [2/4]

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

Definition at line 1392 of file memory.h.

1393{
1394 px = r.px;
1395 pn = r.pn;
1396 return *this;
1397}

◆ operator=() [3/4]

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

◆ operator=() [4/4]

template<typename P >
template<typename P2 >
weak_ptr< P > & CLHEP::weak_ptr< P >::operator= ( weak_ptr< P2 > const r)
throw (
)

Definition at line 1382 of file memory.h.

1383{
1384 px = r.lock().get();
1385 pn = r.pn;
1386 return *this;
1387}

◆ reset()

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

Definition at line 1429 of file memory.h.

1430{
1431 this_type().swap(*this);
1432}

◆ swap()

template<typename P >
void CLHEP::weak_ptr< P >::swap ( this_type other)
throw (
)
inline

Definition at line 1436 of file memory.h.

1437{
1438 std::swap(px, other.px);
1439 pn.swap(other.pn);
1440}
void swap(weak_ctrl_handle &)
Definition: memory.h:647

Referenced by CLHEP::weak_ptr< P >::reset(), and CLHEP::swap().

◆ use_count()

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

Definition at line 1408 of file memory.h.

1409{
1410 return pn.use_count();
1411}

Friends And Related Function Documentation

◆ shared_ptr

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

Definition at line 1305 of file memory.h.

◆ weak_ptr

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

Definition at line 1306 of file memory.h.


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