From 3e40aacce559982afc8920c9c486f962b285976f Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 24 May 2017 01:52:11 +0300 Subject: [PATCH] Document mp_plus --- doc/html/mp11.html | 17 ++++++++++++++++- doc/mp11/function.qbk | 7 +++++++ include/boost/mp11/function.hpp | 1 + test/Jamfile.v2 | 1 + test/mp_plus.cpp | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 test/mp_plus.cpp diff --git a/doc/html/mp11.html b/doc/html/mp11.html index 61b6950..eff6909 100644 --- a/doc/html/mp11.html +++ b/doc/html/mp11.html @@ -172,6 +172,7 @@
mp_or<T...>
mp_any<T...>
mp_same<T...>
+
mp_plus<T...>
Bind, <boost/mp11/bind.hpp>
@@ -2272,6 +2273,20 @@ is mp_true.

+
+ +
template<class... T> using mp_plus = /*...*/;
+
+

+ mp_plus<T...> + is an integral constant type with a value that is the sum of U::value + for all types U in T.... + mp_plus<> + is mp_int<0>. +

+

@@ -2478,7 +2493,7 @@

- +

Last revised: May 23, 2017 at 22:20:27 GMT

Last revised: May 23, 2017 at 22:51:13 GMT


diff --git a/doc/mp11/function.qbk b/doc/mp11/function.qbk index 20700bf..52bab9a 100644 --- a/doc/mp11/function.qbk +++ b/doc/mp11/function.qbk @@ -70,4 +70,11 @@ returns `mp_true`. If all results are `mp_false`, returns `mp_false`. `mp_or<>` `mp_same` is `mp_true` if all the types in `T...` are the same type, `mp_false` otherwise. `mp_same<>` is `mp_true`. [endsect] +[section `mp_plus`] + template using mp_plus = /*...*/; + +`mp_plus` is an integral constant type with a value that is the sum of `U::value` for all types `U` in `T...`. +`mp_plus<>` is `mp_int<0>`. +[endsect] + [endsect:function] diff --git a/include/boost/mp11/function.hpp b/include/boost/mp11/function.hpp index 5b6ef9f..9821f1d 100644 --- a/include/boost/mp11/function.hpp +++ b/include/boost/mp11/function.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace boost diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index e700170..277bc4f 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -103,6 +103,7 @@ run mp_and.cpp : : : $(REQ) ; run mp_any.cpp : : : $(REQ) ; run mp_or.cpp : : : $(REQ) ; run mp_same.cpp : : : $(REQ) ; +run mp_plus.cpp : : : $(REQ) ; # map run mp_map_find.cpp : : : $(REQ) ; diff --git a/test/mp_plus.cpp b/test/mp_plus.cpp new file mode 100644 index 0000000..06c05d2 --- /dev/null +++ b/test/mp_plus.cpp @@ -0,0 +1,32 @@ + +// Copyright 2015-2017 Peter Dimov. +// +// 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 + + +#include +#include +#include + +template using integral = std::integral_constant; + +int main() +{ + using boost::mp11::mp_plus; + + BOOST_TEST_TRAIT_TRUE((std::is_same, integral>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same>, integral>)); + BOOST_TEST_TRAIT_TRUE((std::is_same>, integral>)); + BOOST_TEST_TRAIT_TRUE((std::is_same>, integral>)); + BOOST_TEST_TRAIT_TRUE((std::is_same>, integral>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same, integral>, integral>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, integral, integral>, integral>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, integral, integral, integral>, integral>)); + + return boost::report_errors(); +}