StormByte C++ Library 1.2.0
StormByte is a comprehensive, cross-platform C++ library aimed at easing system programming, configuration management, logging, and database handling tasks. This library provides a unified API that abstracts away the complexities and inconsistencies of different platforms (Windows, Linux).
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
StormByte::Clonable< T, SmartPointer > Class Template Referenceabstract

Polymorphic clone/move into a smart pointer of type T. More...

#include <StormByte/clonable.hxx>

Public Types

using PointerType = SmartPointer
 SmartPointer alias.
 

Public Member Functions

constexpr Clonable ()=default
 Default constructor.
 
constexpr Clonable (const Clonable &)=default
 Copy constructor.
 
constexpr Clonable (Clonable &&) noexcept=default
 Move constructor.
 
constexpr Clonableoperator= (const Clonable &)=default
 Copy assignment.
 
constexpr Clonableoperator= (Clonable &&) noexcept=default
 Move assignment.
 
virtual constexpr ~Clonable () noexcept=default
 Destructor.
 
virtual PointerType Clone () const =0
 Deep copy into a new PointerType.
 
virtual PointerType Move ()=0
 Moves this object into a new PointerType.
 

Static Public Member Functions

template<class Target , typename... Args>
static PointerType MakePointer (Args &&... args)
 Allocates Target and returns it as PointerType.
 

Detailed Description

template<class T, typename SmartPointer = std::shared_ptr<T>>
requires ValidSmartPointer<SmartPointer, T>
class StormByte::Clonable< T, SmartPointer >

Polymorphic clone/move into a smart pointer of type T.

Template Parameters
TMost-derived interface stored in the pointer.
SmartPointerstd::shared_ptr<T> (default) or std::unique_ptr<T>.

Member Typedef Documentation

◆ PointerType

template<class T , typename SmartPointer = std::shared_ptr<T>>
using StormByte::Clonable< T, SmartPointer >::PointerType = SmartPointer

SmartPointer alias.

Constructor & Destructor Documentation

◆ Clonable() [1/3]

template<class T , typename SmartPointer = std::shared_ptr<T>>
constexpr StormByte::Clonable< T, SmartPointer >::Clonable ( )
constexprdefault

Default constructor.

◆ Clonable() [2/3]

template<class T , typename SmartPointer = std::shared_ptr<T>>
constexpr StormByte::Clonable< T, SmartPointer >::Clonable ( const Clonable< T, SmartPointer > &  )
constexprdefault

Copy constructor.

◆ Clonable() [3/3]

template<class T , typename SmartPointer = std::shared_ptr<T>>
constexpr StormByte::Clonable< T, SmartPointer >::Clonable ( Clonable< T, SmartPointer > &&  )
constexprdefaultnoexcept

Move constructor.

◆ ~Clonable()

template<class T , typename SmartPointer = std::shared_ptr<T>>
virtual constexpr StormByte::Clonable< T, SmartPointer >::~Clonable ( )
constexprvirtualdefaultnoexcept

Destructor.

Member Function Documentation

◆ Clone()

template<class T , typename SmartPointer = std::shared_ptr<T>>
virtual PointerType StormByte::Clonable< T, SmartPointer >::Clone ( ) const
pure virtual

Deep copy into a new PointerType.

Returns
Owning pointer to the clone.

◆ MakePointer()

template<class T , typename SmartPointer = std::shared_ptr<T>>
template<class Target , typename... Args>
static PointerType StormByte::Clonable< T, SmartPointer >::MakePointer ( Args &&...  args)
static

Allocates Target and returns it as PointerType.

Template Parameters
TargetConcrete type (T or derived).
ArgsConstructor argument types.
Parameters
argsForwarded to Target.
Returns
shared_ptr or unique_ptr according to PointerType.

◆ Move()

template<class T , typename SmartPointer = std::shared_ptr<T>>
virtual PointerType StormByte::Clonable< T, SmartPointer >::Move ( )
pure virtual

Moves this object into a new PointerType.

Returns
Owning pointer to the moved instance.

◆ operator=() [1/2]

template<class T , typename SmartPointer = std::shared_ptr<T>>
constexpr Clonable & StormByte::Clonable< T, SmartPointer >::operator= ( Clonable< T, SmartPointer > &&  )
constexprdefaultnoexcept

Move assignment.

◆ operator=() [2/2]

template<class T , typename SmartPointer = std::shared_ptr<T>>
constexpr Clonable & StormByte::Clonable< T, SmartPointer >::operator= ( const Clonable< T, SmartPointer > &  )
constexprdefault

Copy assignment.


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