Classes | |
struct | BoolSwitch |
struct | BoolSwitch< true, T > |
struct | False |
struct | HasClone |
struct | True |
Functions | |
template<typename T > | |
T * | Clone (const T &src) |
Clone a given object. More... | |
template<typename T > | |
T * | CloneOne (const T &src) |
template<typename T > | |
True | MatchCloneTag (typename T::IsClonableTag *const) |
template<typename T > | |
False | MatchCloneTag (...) |
DV: For some classes (Type
) that inherit from an pure abstract base class we can not call a (non-existing) copy constructor, i.e. we can not use new Type(t)
. The utl::CopyOrClone class does some meta-programming magic and uses copy constructor for normal objects and switches to a virtual copy constructor Clone()
static method when it exists.
T* utl::ShadowPtrMeta::Clone | ( | const T & | src | ) |
Clone a given object.
src | Object to be cloned |
This function exists as a customization point for the ShadowPtr template for classes which need a special cloning mechanism. If a class c
is accompanied by a function c* Clone(const c& src)
in the same namespace, it will get used instead of the this templated function due to Koenig lookup.
Clone
template function. If an overloaded function gets called instead, the instantiation does not take place. The class specific Clone
function can be declared in the header and defined with the rest of the class. This re-enables the use of forward declarations with shadow pointers, at the price of providing the class specific Clone
. Definition at line 69 of file ShadowPtr.h.
Referenced by CloneOne().
T* utl::ShadowPtrMeta::CloneOne | ( | const T & | src | ) |
Definition at line 73 of file ShadowPtr.h.
References Clone().
True utl::ShadowPtrMeta::MatchCloneTag | ( | typename T::IsClonableTag * | const | ) |
False utl::ShadowPtrMeta::MatchCloneTag | ( | ... | ) |