libhext: C++ Library Documentation  1.0.8-3ad0ae4
Public Member Functions | List of all members
hext::Cloneable< Derived, Base > Class Template Reference

Curiously recurring template pattern that extends a base class to provide a virtual method Cloneable::clone(). More...

Inheritance diagram for hext::Cloneable< Derived, Base >:
Inheritance graph
[legend]
Collaboration diagram for hext::Cloneable< Derived, Base >:
Collaboration graph
[legend]

Public Member Functions

virtual std::unique_ptr< Base > clone () const override
 Clones objects of template type Derived and returns an owning pointer to the newly allocated Base. More...
 

Detailed Description

template<typename Derived, typename Base>
class hext::Cloneable< Derived, Base >

Curiously recurring template pattern that extends a base class to provide a virtual method Cloneable::clone().

Template Parameters
DerivedA subclass of Cloneable that is copy constructible.
BaseThe base class that shall be extended.

Definition at line 36 of file Cloneable.h.

Member Function Documentation

◆ clone()

template<typename Derived , typename Base >
virtual std::unique_ptr<Base> hext::Cloneable< Derived, Base >::clone ( ) const
inlineoverridevirtual

Clones objects of template type Derived and returns an owning pointer to the newly allocated Base.

Fails at compile time if template parameter Base is not a base of template parameter Derived or if template parameter Derived is not copy constructible.

Definition at line 45 of file Cloneable.h.


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