/usr/include/boost/hana/ext/std
Edit: /usr/include/boost/hana/ext/std/integral_constant.hpp (2975B)
/*!
@file
Adapts `std::integral_constant` 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_STD_INTEGRAL_CONSTANT_HPP
#define BOOST_HANA_EXT_STD_INTEGRAL_CONSTANT_HPP
#include
#include
#include
#include
#include
#include
#include
#ifdef BOOST_HANA_DOXYGEN_INVOKED
namespace std {
//! @ingroup group-ext-std
//! Adapter for `std::integral_constant`s.
//!
//! Provided models
//! ---------------
//! 1. `Constant` and `IntegralConstant`\n
//! A `std::integral_constant` 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/std/integral_constant.cpp
template
struct integral_constant { };
}
#endif
BOOST_HANA_NAMESPACE_BEGIN
namespace ext { namespace std {
template
struct integral_constant_tag { using value_type = T; };
}}
namespace detail {
template
constexpr bool
is_std_integral_constant(std::integral_constant*)
{ return true; }
constexpr bool is_std_integral_constant(...)
{ return false; }
template
constexpr bool
is_hana_integral_constant(hana::integral_constant*)
{ return true; }
constexpr bool is_hana_integral_constant(...)
{ return false; }
}
template
struct tag_of> {
using type = ext::std::integral_constant_tag<
typename hana::tag_of::type
>;
};
//////////////////////////////////////////////////////////////////////////
// Constant/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 std::integral_constant{};
}
};
BOOST_HANA_NAMESPACE_END
#endif // !BOOST_HANA_EXT_STD_INTEGRAL_CONSTANT_HPP