-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();
+}