refactor: derived_from concepts refactored

This commit is contained in:
Mateusz Pusz
2020-09-11 21:23:46 +02:00
parent f4747a4d7d
commit 47c1930721
2 changed files with 4 additions and 4 deletions

View File

@@ -61,7 +61,7 @@ void to_prefix_base(const volatile prefix_base<PF, R>*);
* Satisfied by all specializations of `prefix`. * Satisfied by all specializations of `prefix`.
*/ */
template<typename T> template<typename T>
concept Prefix = requires(const volatile T* t) { detail::to_prefix_base(t); }; concept Prefix = requires(T* t) { detail::to_prefix_base(t); };
/** /**
* @brief A concept matching unit's ratio * @brief A concept matching unit's ratio
@@ -90,7 +90,7 @@ void to_base_scaled_unit(const volatile scaled_unit<R, U>*);
* Satisfied by all unit types derived from an specialization of :class:`scaled_unit`. * Satisfied by all unit types derived from an specialization of :class:`scaled_unit`.
*/ */
template<typename T> template<typename T>
concept Unit = requires { detail::to_base_scaled_unit(std::declval<const volatile T*>()); }; concept Unit = requires(T* t) { detail::to_base_scaled_unit(t); };
// BaseDimension // BaseDimension
template<basic_fixed_string Symbol, Unit U> template<basic_fixed_string Symbol, Unit U>
@@ -110,7 +110,7 @@ void to_base_base_dimension(const volatile base_dimension<Symbol, U>*);
* Satisfied by all dimension types derived from an specialization of `base_dimension`. * Satisfied by all dimension types derived from an specialization of `base_dimension`.
*/ */
template<typename T> template<typename T>
concept BaseDimension = requires { detail::to_base_base_dimension(std::declval<const volatile T*>()); }; concept BaseDimension = requires(T* t) { detail::to_base_base_dimension(t); };
// Exponent // Exponent
namespace detail { namespace detail {

View File

@@ -75,6 +75,6 @@ void to_base_specialization_of(const volatile Type<Params...>*);
template<typename T, template<typename...> typename Type> template<typename T, template<typename...> typename Type>
// inline constexpr bool // TODO: Replace with concept when it works with MSVC // inline constexpr bool // TODO: Replace with concept when it works with MSVC
concept is_derived_from_specialization_of = requires { detail::to_base_specialization_of<Type>(std::declval<const volatile T*>()); }; concept is_derived_from_specialization_of = requires(T* t) { detail::to_base_specialization_of<Type>(t); };
} // namespace units } // namespace units