13template <
template <
typename>
class T,
typename Derived>
14 requires std::is_class_v<Derived> && std::same_as<Derived, std::remove_cv_t<Derived>>
17 constexpr auto self() noexcept -> Derived& {
18 static_assert(std::derived_from<Derived, T<Derived>>);
19 return static_cast<Derived&
>(*this);
23 constexpr auto self() const noexcept -> Derived const& {
24 static_assert(std::derived_from<Derived, T<Derived>>);
25 return static_cast<const Derived&
>(*this);
29 constexpr auto operator<=>(
const crtp&)
const noexcept =
default;
GW namespace.
Definition concepts.hpp:14
CRTP base class.
Definition crtp.hpp:15
constexpr auto self() const noexcept -> Derived const &
Returns a reference to the derived class.
Definition crtp.hpp:23
constexpr auto self() noexcept -> Derived &
Returns a reference to the derived class.
Definition crtp.hpp:17