ThePEG 2.3.0
|
AnyReference is inspired by boost::any to hold a reference to an object of arbitrary type. More...
#include <AnyReference.h>
Classes | |
struct | ReferenceHolder |
struct | ReferenceHolderBase |
Public Member Functions | |
AnyReference () | |
The default constructor. | |
template<class T > | |
AnyReference (T &v) | |
The standard constructor. | |
AnyReference (const AnyReference &other) | |
The copy constructor. | |
~AnyReference () | |
The destructor. | |
const std::type_info & | type () const |
Return the type held. | |
bool | empty () const |
Return true, if no reference is held. | |
AnyReference & | swap (AnyReference &other) |
Swap the references held. | |
template<class T > | |
AnyReference & | operator= (T &v) |
Assign from definite type. | |
AnyReference & | operator= (AnyReference other) |
Assign from AnyReference. | |
void | reset () |
Reset to not keep track of any reference. | |
template<class T > | |
T & | cast () const |
Extract the held reference. | |
Private Attributes | |
ReferenceHolderBase * | holder |
The reference holder used. | |
AnyReference is inspired by boost::any to hold a reference to an object of arbitrary type.
Definition at line 22 of file AnyReference.h.
|
inline |
|
inline |
The standard constructor.
Definition at line 104 of file AnyReference.h.
|
inline |
The copy constructor.
Definition at line 110 of file AnyReference.h.
|
inline |
|
inline |
Extract the held reference.
Definition at line 171 of file AnyReference.h.
References ThePEG::Exception::abortnow, empty(), holder, ThePEG::AnyReference::ReferenceHolder< T >::init(), and type().
|
inline |
Return true, if no reference is held.
Definition at line 130 of file AnyReference.h.
References holder.
Referenced by cast().
|
inline |
|
inline |
Assign from definite type.
Definition at line 145 of file AnyReference.h.
References AnyReference().
|
inline |
Reset to not keep track of any reference.
Definition at line 161 of file AnyReference.h.
References holder.
|
inline |
Swap the references held.
Definition at line 137 of file AnyReference.h.
References holder, and std::swap().
Referenced by operator=().
|
inline |
Return the type held.
Definition at line 125 of file AnyReference.h.
References holder, and ThePEG::AnyReference::ReferenceHolderBase::type().
Referenced by cast().
|
private |
The reference holder used.
Definition at line 90 of file AnyReference.h.
Referenced by cast(), empty(), reset(), swap(), type(), and ~AnyReference().