6#ifndef SIMPLE_UTILITY_CRTP_BASE_HPP
7#define SIMPLE_UTILITY_CRTP_BASE_HPP
20 template <concepts::unqualified Derived,
class Disambiguity =
void>
29 constexpr const Derived&
derived() const noexcept
31 return static_cast<const Derived&
>(*this);
41 return static_cast<Derived&
>(*this);
49 static_assert(std::is_base_of_v<CRTPBase, Derived>,
"Derived doesn't inherit from CRTPBase.");
Utility type, which can be used as a base class for the crtp pattern.
Definition: CRTPBase.hpp:22
~CRTPBase()=default
Defaulted destructor.
CRTPBase & operator=(const CRTPBase &)=default
Defaulted copy-assignment operator.
CRTPBase(const CRTPBase &)=default
Defaulted copy-constructor.
constexpr const Derived & derived() const noexcept
Up-casts the this pointer to a const lvalue reference to Derived.
Definition: CRTPBase.hpp:29
constexpr Derived & derived() noexcept
Up-casts the this pointer to a lvalue reference to Derived.
Definition: CRTPBase.hpp:39
CRTPBase(CRTPBase &&)=default
Defaulted move-constructor.
constexpr bool operator==(const CRTPBase &) const noexcept=default
Defaulted equality operator.
constexpr CRTPBase() noexcept
Default constructor, performing compile-time checks.
Definition: CRTPBase.hpp:47
Definition: operators.hpp:15