22 #ifndef GEARS_CONCEPTS_ALIAS_HPP
23 #define GEARS_CONCEPTS_ALIAS_HPP
25 #include <type_traits>
30 using Bare =
typename std::remove_cv<typename std::remove_reference<T>::type>::type;
33 using ConstLRef =
const Bare<T>&;
36 using LRef = Bare<T>&;
39 using RRef = Bare<T>&&;
41 template<
typename... Args>
42 struct And : std::true_type {};
44 template<
typename T,
typename... Args>
45 struct And<T, Args...> : std::conditional<T::value, And<Args...>, std::false_type>::type {};
47 template<
typename... Args>
48 struct Or : std::false_type {};
50 template<
typename T,
typename... Args>
51 struct Or<T, Args...> : std::conditional<T::value, std::true_type, Or<Args...>>::type {};
53 template<
typename Test,
typename... Args>
54 using TraitOf = decltype(Test::template test<Args...>(0));
56 enum class concept_checker_t {};
58 template<
typename... Concepts>
59 struct requires_checker {
60 static_assert(And<Concepts...>(),
"Concept Violation");
61 using type = concept_checker_t;
64 template<
typename... Concepts>
65 using TrueIf =
typename std::enable_if<And<Concepts...>::value, concept_checker_t>::type;
67 template<
typename... Concepts>
68 using Require =
typename requires_checker<Concepts...>::type;
97 template<
typename T,
template<
typename...>
class... Concepts>
99 static_assert(And<Concepts<T>...>(),
"Concept Violation");
105 #endif // GEARS_CONCEPTS_ALIAS_HPP