Simple-Utility v2.3.1
Loading...
Searching...
No Matches
sl::CRTPBase< Derived, Disambiguity > Class Template Reference

Utility type, which can be used as a base class for the crtp pattern. More...

#include <CRTPBase.hpp>

Inheritance diagram for sl::CRTPBase< Derived, Disambiguity >:
[legend]

Protected Member Functions

constexpr const Derived & derived () const noexcept
 Up-casts the this pointer to a const lvalue reference to Derived.
 
constexpr Derived & derived () noexcept
 Up-casts the this pointer to a lvalue reference to Derived.
 
constexpr CRTPBase () noexcept
 Default constructor, performing compile-time checks.
 
 CRTPBase (const CRTPBase &)=default
 Defaulted copy-constructor.
 
CRTPBaseoperator= (const CRTPBase &)=default
 Defaulted copy-assignment operator.
 
 CRTPBase (CRTPBase &&)=default
 Defaulted move-constructor.
 
CRTPBaseoperator= (CRTPBase &&)=default
 Defaulted move-assignment operator.
 
 ~CRTPBase ()=default
 Defaulted destructor.
 
constexpr bool operator== (const CRTPBase &) const noexcept=default
 Defaulted equality operator.
 

Detailed Description

template<concepts::unqualified Derived, class Disambiguity = void>
class sl::CRTPBase< Derived, Disambiguity >

Utility type, which can be used as a base class for the crtp pattern.

Template Parameters
DerivedThe derived type.
DisambiguityIn cases of multiple inheritance, this param can be used to disambiguity the base class.

Constructor & Destructor Documentation

◆ CRTPBase() [1/3]

template<concepts::unqualified Derived, class Disambiguity = void>
constexpr sl::CRTPBase< Derived, Disambiguity >::CRTPBase ( )
inlineconstexprprotectednoexcept

Default constructor, performing compile-time checks.

◆ CRTPBase() [2/3]

template<concepts::unqualified Derived, class Disambiguity = void>
sl::CRTPBase< Derived, Disambiguity >::CRTPBase ( const CRTPBase< Derived, Disambiguity > &  )
protecteddefault

Defaulted copy-constructor.

◆ CRTPBase() [3/3]

template<concepts::unqualified Derived, class Disambiguity = void>
sl::CRTPBase< Derived, Disambiguity >::CRTPBase ( CRTPBase< Derived, Disambiguity > &&  )
protecteddefault

Defaulted move-constructor.

◆ ~CRTPBase()

template<concepts::unqualified Derived, class Disambiguity = void>
sl::CRTPBase< Derived, Disambiguity >::~CRTPBase ( )
protecteddefault

Defaulted destructor.

Member Function Documentation

◆ derived() [1/2]

template<concepts::unqualified Derived, class Disambiguity = void>
constexpr const Derived & sl::CRTPBase< Derived, Disambiguity >::derived ( ) const
inlineconstexprprotectednoexcept

Up-casts the this pointer to a const lvalue reference to Derived.

Returns
A const lvalue reference.

◆ derived() [2/2]

template<concepts::unqualified Derived, class Disambiguity = void>
constexpr Derived & sl::CRTPBase< Derived, Disambiguity >::derived ( )
inlineconstexprprotectednoexcept

Up-casts the this pointer to a lvalue reference to Derived.

Returns
A lvalue reference.

◆ operator=() [1/2]

template<concepts::unqualified Derived, class Disambiguity = void>
CRTPBase & sl::CRTPBase< Derived, Disambiguity >::operator= ( const CRTPBase< Derived, Disambiguity > &  )
protecteddefault

Defaulted copy-assignment operator.

◆ operator=() [2/2]

template<concepts::unqualified Derived, class Disambiguity = void>
CRTPBase & sl::CRTPBase< Derived, Disambiguity >::operator= ( CRTPBase< Derived, Disambiguity > &&  )
protecteddefault

Defaulted move-assignment operator.

◆ operator==()

template<concepts::unqualified Derived, class Disambiguity = void>
constexpr bool sl::CRTPBase< Derived, Disambiguity >::operator== ( const CRTPBase< Derived, Disambiguity > &  ) const
constexprprotecteddefaultnoexcept

Defaulted equality operator.

Returns
Returns true, if both operators are equal.

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