diff --git a/doc/html/mp11.html b/doc/html/mp11.html index 06276b0..2c2c378 100644 --- a/doc/html/mp11.html +++ b/doc/html/mp11.html @@ -2029,7 +2029,7 @@

mp_for_each<L>(f) calls - f with mp_identity<T>() for each element T + f with T() for each element T of the list L, in order.

@@ -2504,7 +2504,7 @@ - +

Last revised: May 25, 2017 at 18:31:25 GMT

Last revised: May 28, 2017 at 23:51:44 GMT


diff --git a/doc/mp11/algorithm.qbk b/doc/mp11/algorithm.qbk index 9f603f9..08f7a53 100644 --- a/doc/mp11/algorithm.qbk +++ b/doc/mp11/algorithm.qbk @@ -284,7 +284,7 @@ is `mp_size`. [section `mp_for_each(f)`] template constexpr F mp_for_each(F&& f); -`mp_for_each(f)` calls `f` with `mp_identity()` for each element `T` of the list `L`, in order. +`mp_for_each(f)` calls `f` with `T()` for each element `T` of the list `L`, in order. Returns `std::forward(f)`. [endsect] diff --git a/include/boost/mp11/algorithm.hpp b/include/boost/mp11/algorithm.hpp index 0f68974..d33b248 100644 --- a/include/boost/mp11/algorithm.hpp +++ b/include/boost/mp11/algorithm.hpp @@ -882,7 +882,7 @@ namespace detail template BOOST_CONSTEXPR F mp_for_each_impl( mp_list, F && f ) { using A = int[sizeof...(T)]; - return (void)A{ ((void)f(mp_identity()), 0)... }, std::forward(f); + return (void)A{ ((void)f(T()), 0)... }, std::forward(f); } #if BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) diff --git a/test/mp_for_each.cpp b/test/mp_for_each.cpp index 31ad7c5..542493b 100644 --- a/test/mp_for_each.cpp +++ b/test/mp_for_each.cpp @@ -14,8 +14,6 @@ #include #include -using boost::mp11::mp_identity; - #if !defined( BOOST_NO_CXX14_CONSTEXPR ) # define CONSTEXPR14 constexpr #else @@ -26,9 +24,9 @@ struct F { int s; - CONSTEXPR14 void operator()( mp_identity ) { s = s * 10 + 1; } - CONSTEXPR14 void operator()( mp_identity ) { s = s * 10 + 2; } - CONSTEXPR14 void operator()( mp_identity ) { s = s * 10 + 3; } + CONSTEXPR14 void operator()( int ) { s = s * 10 + 1; } + CONSTEXPR14 void operator()( short ) { s = s * 10 + 2; } + CONSTEXPR14 void operator()( char ) { s = s * 10 + 3; } }; using boost::mp11::mp_list;