1.8
Public Member Functions | List of all members
CopyOnWriteAllocate< T > Class Template Reference

Copy-On-Write wrapper for an object or container. More...

Public Member Functions

 CopyOnWriteAllocate ()=default
 
 CopyOnWriteAllocate (const std::shared_ptr< T > &refptr)
 Construct with a shared_ptr to the object. More...
 
 CopyOnWriteAllocate (T *t)
 Construct with a pointer to the object. This now owns the pointer. More...
 
 operator bool () const
 Bool operator. More...
 
T & operator* ()
 Dereference operator. More...
 
const T & operator* () const
 Dereference operator. This will allocate. More...
 
T * operator-> ()
 Arrow operator. More...
 
const T * operator-> () const
 Arrow operator. More...
 

Detailed Description

template<class T>
class egt::v1::detail::CopyOnWriteAllocate< T >

Copy-On-Write wrapper for an object or container.

This creates copy on write semantics for an object. This also performs lazy initialization of the object and will automatically default construct it when needed.

Constructor & Destructor Documentation

◆ CopyOnWriteAllocate() [1/3]

CopyOnWriteAllocate ( )
default

◆ CopyOnWriteAllocate() [2/3]

CopyOnWriteAllocate ( T *  t)
inlineexplicit

Construct with a pointer to the object. This now owns the pointer.

◆ CopyOnWriteAllocate() [3/3]

CopyOnWriteAllocate ( const std::shared_ptr< T > &  refptr)
inlineexplicit

Construct with a shared_ptr to the object.

Member Function Documentation

◆ operator bool()

operator bool ( ) const
inlineexplicit

Bool operator.

◆ operator*() [1/2]

T& operator* ( )
inline

Dereference operator.

◆ operator*() [2/2]

const T& operator* ( ) const
inline

Dereference operator. This will allocate.

◆ operator->() [1/2]

T* operator-> ( )
inline

Arrow operator.

◆ operator->() [2/2]

const T* operator-> ( ) const
inline

Arrow operator.