// 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) #include #include #include #include #include namespace hana = boost::hana; // Define a simple model of IntegralConstant struct constant_tag { using value_type = int; }; template struct constant { static constexpr int value = i; using hana_tag = constant_tag; }; namespace boost { namespace hana { template <> struct IntegralConstant { static constexpr bool value = true; }; template struct to_impl::value>> { template static constexpr auto apply(N const&) { return constant{}; } }; }} // Make sure we really satisfy IntegralConstant<>. static_assert(hana::IntegralConstant>::value, ""); static_assert(hana::IntegralConstant>::value, ""); static_assert(hana::IntegralConstant>::value, ""); // Make sure we're also a model of Constant automatically. static_assert(hana::Constant>::value, ""); static_assert(hana::Constant>::value, ""); static_assert(hana::Constant>::value, ""); // Make sure we have the hana::value<> function defined automatically. static_assert(hana::value>() == 0, ""); static_assert(hana::value>() == 1, ""); static_assert(hana::value>() == 2, ""); static_assert(hana::value>() == 3, ""); int main() { }