1
0
forked from boostorg/mp11
Files
boost_mp11/doc/mp11/integral.adoc

61 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2017-06-07 00:02:25 +03:00
////
Copyright 2017 Peter Dimov
2017-03-14 22:57:07 +02:00
2017-06-07 00:02:25 +03:00
Distributed under the Boost Software License, Version 1.0.
See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
////
[#integral]
# Integral Constants, <boost/mp11/integral.hpp>
:toc:
2017-06-07 00:10:28 +03:00
:toc-title:
2017-06-07 00:02:25 +03:00
:idprefix:
2017-03-14 22:57:07 +02:00
2017-03-16 19:45:47 +02:00
For an Mp11 integral constant type `T`, `T::value` is an integral constant in the C++ sense.
2017-06-07 00:02:25 +03:00
## mp_bool<B>
2017-03-14 22:57:07 +02:00
template<bool B> using mp_bool = std::integral_constant<bool, B>;
2017-06-10 03:44:31 +03:00
Same as `std::bool_constant` in C++17.
2017-06-07 00:02:25 +03:00
## mp_true
2017-03-14 22:57:07 +02:00
using mp_true = mp_bool<true>;
2017-06-10 03:44:31 +03:00
Same as `std::true_type`.
2017-06-07 00:02:25 +03:00
## mp_false
2017-03-14 22:57:07 +02:00
using mp_false = mp_bool<false>;
2017-06-10 03:44:31 +03:00
Same as `std::false_type`.
2017-06-07 00:02:25 +03:00
## mp_to_bool<T>
2017-03-14 22:57:07 +02:00
template<class T> using mp_to_bool = mp_bool<static_cast<bool>(T::value)>;
2017-06-07 00:02:25 +03:00
## mp_not<T>
2017-03-14 22:57:07 +02:00
template<class T> using mp_not = mp_bool< !T::value >;
2017-06-07 00:02:25 +03:00
## mp_int<I>
2017-03-14 22:57:07 +02:00
template<int I> using mp_int = std::integral_constant<int, I>;
2017-06-07 00:02:25 +03:00
## mp_size_t<N>
2017-03-14 22:57:07 +02:00
2017-06-07 00:02:25 +03:00
template<std::size_t N> using mp_size_t = std::integral_constant<std::size_t, N>;
2023-05-15 02:54:18 +03:00
## mp_value<A>
template<auto A> using mp_value = std::integral_constant<decltype(A), A>;
When a value list is converted to a type list, either explicitly via `mp_rename`, or
implicitly by a primitive that supports value lists directly, its values are converted
to types by wrapping then with `mp_value`.
Requires {cpp}17.