/*! @file Adapts Boost.MPL IntegralConstants for use with Hana. @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 BOOST_HANA_EXT_BOOST_MPL_INTEGRAL_C_HPP #define BOOST_HANA_EXT_BOOST_MPL_INTEGRAL_C_HPP #include #include #include #include #include #include #include #include #ifdef BOOST_HANA_DOXYGEN_INVOKED namespace boost { namespace mpl { //! @ingroup group-ext-mpl //! Adapter for IntegralConstants from the Boost.MPL. //! //! Provided models //! --------------- //! 1. `Constant` and `IntegralConstant`\n //! A Boost.MPL IntegralConstant is a model of the `IntegralConstant` //! and `Constant` concepts just like `hana::integral_constant`s are. //! As a consequence, they are also implicitly a model of the concepts //! provided for all models of `Constant`. //! @include example/ext/boost/mpl/integral_c/integral_constant.cpp template struct integral_c { }; }} #endif BOOST_HANA_NAMESPACE_BEGIN namespace ext { namespace boost { namespace mpl { template struct integral_c_tag { using value_type = T; }; }}} template struct tag_of::value >> { using type = ext::boost::mpl::integral_c_tag< typename hana::tag_of::type >; }; ////////////////////////////////////////////////////////////////////////// // IntegralConstant/Constant ////////////////////////////////////////////////////////////////////////// template struct IntegralConstant> { static constexpr bool value = true; }; template struct to_impl, C, when::value> > : embedding::value> { template static constexpr auto apply(N const&) { return ::boost::mpl::integral_c{}; } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_EXT_BOOST_MPL_INTEGRAL_C_HPP