/*! @file Forward declares `boost::hana::integral_constant`. Copyright Louis Dionne 2013-2022 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_FWD_INTEGRAL_CONSTANT_HPP #define BOOST_HANA_FWD_INTEGRAL_CONSTANT_HPP #include #include #include namespace boost { namespace hana { //! Creates an `integral_constant` holding the given compile-time value. //! @relates hana::integral_constant //! //! Specifically, `integral_c` is a `hana::integral_constant` //! holding the compile-time value `v` of an integral type `T`. //! //! //! @tparam T //! The type of the value to hold in the `integral_constant`. //! It must be an integral type. //! //! @tparam v //! The integral value to hold in the `integral_constant`. //! //! //! Example //! ------- //! @snippet example/integral_constant.cpp integral_c template BOOST_HANA_INLINE_VARIABLE constexpr integral_constant integral_c{}; //! @relates hana::integral_constant template using bool_ = integral_constant; //! @relates hana::integral_constant template BOOST_HANA_INLINE_VARIABLE constexpr bool_ bool_c{}; //! @relates hana::integral_constant using true_ = bool_; //! @relates hana::integral_constant BOOST_HANA_INLINE_VARIABLE constexpr auto true_c = bool_c; //! @relates hana::integral_constant using false_ = bool_; //! @relates hana::integral_constant BOOST_HANA_INLINE_VARIABLE constexpr auto false_c = bool_c; //! @relates hana::integral_constant template using char_ = integral_constant; //! @relates hana::integral_constant template BOOST_HANA_INLINE_VARIABLE constexpr char_ char_c{}; //! @relates hana::integral_constant template using short_ = integral_constant; //! @relates hana::integral_constant template BOOST_HANA_INLINE_VARIABLE constexpr short_ short_c{}; //! @relates hana::integral_constant template using ushort_ = integral_constant; //! @relates hana::integral_constant template BOOST_HANA_INLINE_VARIABLE constexpr ushort_ ushort_c{}; //! @relates hana::integral_constant template using int_ = integral_constant; //! @relates hana::integral_constant template BOOST_HANA_INLINE_VARIABLE constexpr int_ int_c{}; //! @relates hana::integral_constant template using uint = integral_constant; //! @relates hana::integral_constant template BOOST_HANA_INLINE_VARIABLE constexpr uint uint_c{}; //! @relates hana::integral_constant template using long_ = integral_constant; //! @relates hana::integral_constant template BOOST_HANA_INLINE_VARIABLE constexpr long_ long_c{}; //! @relates hana::integral_constant template using ulong = integral_constant; //! @relates hana::integral_constant template BOOST_HANA_INLINE_VARIABLE constexpr ulong ulong_c{}; //! @relates hana::integral_constant template using llong = integral_constant; //! @relates hana::integral_constant template BOOST_HANA_INLINE_VARIABLE constexpr llong llong_c{}; //! @relates hana::integral_constant template using ullong = integral_constant; //! @relates hana::integral_constant template BOOST_HANA_INLINE_VARIABLE constexpr ullong ullong_c{}; //! @relates hana::integral_constant template using size_t = integral_constant; //! @relates hana::integral_constant template BOOST_HANA_INLINE_VARIABLE constexpr size_t size_c{}; namespace literals { //! Creates a `hana::integral_constant` from a literal. //! @relatesalso boost::hana::integral_constant //! //! The literal is parsed at compile-time and the result is returned //! as a `llong<...>`. //! //! @note //! We use `llong<...>` instead of `ullong<...>` because using an //! unsigned type leads to unexpected behavior when doing stuff like //! `-1_c`. If we used an unsigned type, `-1_c` would be something //! like `ullong<-1>` which is actually `ullong`. //! //! //! Example //! ------- //! @snippet example/integral_constant.cpp literals template constexpr auto operator"" _c(); } }} // end namespace boost::hana #endif // !BOOST_HANA_FWD_INTEGRAL_CONSTANT_HPP