From c284b7e25a60a40e69ab65002537dcce77577ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johel=20Ernesto=20Guerrero=20Pe=C3=B1a?= Date: Wed, 9 Sep 2020 18:36:56 -0400 Subject: [PATCH] refactor: simplify Prefix --- src/include/units/concepts.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/include/units/concepts.h b/src/include/units/concepts.h index 7e08fbb1..0cdb8bdb 100644 --- a/src/include/units/concepts.h +++ b/src/include/units/concepts.h @@ -50,14 +50,8 @@ namespace detail { template struct prefix_base; -struct is_derived_from_prefix_base_impl { - template - static constexpr std::true_type check_base(const prefix_base&); - static constexpr std::false_type check_base(...); -}; - -template -inline constexpr bool is_derived_from_prefix_base = decltype(is_derived_from_prefix_base_impl::check_base(std::declval()))::value; +template +void to_prefix_base(const volatile prefix_base*); } // namespace detail @@ -67,7 +61,7 @@ inline constexpr bool is_derived_from_prefix_base = decltype(is_derived_from_pre * Satisfied by all specializations of `prefix`. */ template -concept Prefix = detail::is_derived_from_prefix_base; +concept Prefix = requires(const volatile T* t) { detail::to_prefix_base(t); }; /** * @brief A concept matching unit's ratio