diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2023-06-09 14:22:10 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2023-06-09 14:22:10 +0200 |
| commit | 133d748e79fa41288b175ac17abecd6012a008e8 (patch) | |
| tree | e31fefd77b69564a4e5ed89a35658520d3528d8c | |
| parent | bb9a394db891b9b1105be9fe5738489e356cdb77 (diff) | |
| download | newtype-133d748e79fa41288b175ac17abecd6012a008e8.tar.xz newtype-133d748e79fa41288b175ac17abecd6012a008e8.zip | |
newtype: remove left-over enable_ifs
| -rw-r--r-- | source/lib/include/newtype/newtype.hpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/lib/include/newtype/newtype.hpp b/source/lib/include/newtype/newtype.hpp index aee68da..74896ef 100644 --- a/source/lib/include/newtype/newtype.hpp +++ b/source/lib/include/newtype/newtype.hpp @@ -928,26 +928,30 @@ namespace nt return this->m_value; } - template<typename NewType = new_type, std::enable_if_t<NewType::derivation_clause(nt::ImplicitConversion)> * = nullptr> + template<typename DerivationClauseT = decltype(DerivationClause)> constexpr operator base_type() const noexcept(std::is_nothrow_copy_constructible_v<base_type>) + requires(nt::contains<DerivationClauseT, nt::ImplicitConversion>) { return decay(); } - template<typename NewType = new_type, std::enable_if_t<!NewType::derivation_clause(nt::ImplicitConversion)> * = nullptr> + template<typename DerivationClauseT = decltype(DerivationClause)> explicit constexpr operator base_type() const noexcept(std::is_nothrow_copy_constructible_v<base_type>) + requires(!nt::contains<DerivationClauseT, nt::ImplicitConversion>) { return decay(); } - template<typename NewType = new_type> - auto constexpr operator->() noexcept -> std::enable_if_t<NewType::derivation_clause(nt::Indirection), BaseType *> + template<typename DerivationClauseT = decltype(DerivationClause)> + requires(nt::contains<DerivationClauseT, nt::Indirection>) + auto constexpr operator->() noexcept -> BaseType * { return std::addressof(this->m_value); } - template<typename NewType = new_type> - auto constexpr operator->() const noexcept -> std::enable_if_t<NewType::derivation_clause(nt::Indirection), BaseType const *> + template<typename DerivationClauseT = decltype(DerivationClause)> + requires(nt::contains<DerivationClauseT, nt::Indirection>) + auto constexpr operator->() const noexcept -> BaseType const * { return std::addressof(this->m_value); } |
