// Copyright Louis Dionne 2013-2017 // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) #ifndef TEST_SUPPORT_CNUMERIC_HPP #define TEST_SUPPORT_CNUMERIC_HPP #include #include #include #include #include template struct CNumeric { using value_type = T; }; template struct cnumeric_t { static constexpr T value = v; using hana_tag = CNumeric; constexpr operator T() const { return value; } }; template constexpr cnumeric_t cnumeric{}; template constexpr cnumeric_t make_cnumeric() { return {}; } namespace boost { namespace hana { // Constant and IntegralConstant template struct IntegralConstant> { static constexpr bool value = true; }; template struct to_impl, C, when< hana::IntegralConstant::value >> : embedding::value> { template static constexpr auto apply(N const&) { return cnumeric; } }; // Comparable template struct equal_impl, CNumeric> { template static constexpr auto apply(X const&, Y const&) { return cnumeric; } }; // Orderable template struct less_impl, CNumeric> { template static constexpr auto apply(X const&, Y const&) { return cnumeric; } }; }} // end namespace boost::hana #endif // !TEST_SUPPORT_CNUMERIC_HPP