1
0
forked from boostorg/mp11

Change back mp_for_each to not use mp_identity

This commit is contained in:
Peter Dimov
2017-05-29 03:04:12 +03:00
parent 75f7f442fa
commit c7923ca041
4 changed files with 7 additions and 9 deletions

View File

@@ -2029,7 +2029,7 @@
</pre>
<p>
<code class="computeroutput"><span class="identifier">mp_for_each</span><span class="special">&lt;</span><span class="identifier">L</span><span class="special">&gt;(</span><span class="identifier">f</span><span class="special">)</span></code> calls
<code class="computeroutput"><span class="identifier">f</span></code> with <code class="computeroutput"><span class="identifier">mp_identity</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;()</span></code> for each element <code class="computeroutput"><span class="identifier">T</span></code>
<code class="computeroutput"><span class="identifier">f</span></code> with <code class="computeroutput"><span class="identifier">T</span><span class="special">()</span></code> for each element <code class="computeroutput"><span class="identifier">T</span></code>
of the list <code class="computeroutput"><span class="identifier">L</span></code>, in order.
</p>
<p>
@@ -2504,7 +2504,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: May 25, 2017 at 18:31:25 GMT</small></p></td>
<td align="left"><p><small>Last revised: May 28, 2017 at 23:51:44 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>

View File

@@ -284,7 +284,7 @@ is `mp_size<L>`.
[section `mp_for_each<L>(f)`]
template<class L, class F> constexpr F mp_for_each(F&& f);
`mp_for_each<L>(f)` calls `f` with `mp_identity<T>()` for each element `T` of the list `L`, in order.
`mp_for_each<L>(f)` calls `f` with `T()` for each element `T` of the list `L`, in order.
Returns `std::forward<F>(f)`.
[endsect]

View File

@@ -882,7 +882,7 @@ namespace detail
template<class... T, class F> BOOST_CONSTEXPR F mp_for_each_impl( mp_list<T...>, F && f )
{
using A = int[sizeof...(T)];
return (void)A{ ((void)f(mp_identity<T>()), 0)... }, std::forward<F>(f);
return (void)A{ ((void)f(T()), 0)... }, std::forward<F>(f);
}
#if BOOST_WORKAROUND( BOOST_MSVC, <= 1800 )

View File

@@ -14,8 +14,6 @@
#include <boost/detail/workaround.hpp>
#include <tuple>
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<int> ) { s = s * 10 + 1; }
CONSTEXPR14 void operator()( mp_identity<short> ) { s = s * 10 + 2; }
CONSTEXPR14 void operator()( mp_identity<char> ) { 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;