forked from boostorg/mp11
Change back mp_for_each to not use mp_identity
This commit is contained in:
@@ -2029,7 +2029,7 @@
|
|||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
<code class="computeroutput"><span class="identifier">mp_for_each</span><span class="special"><</span><span class="identifier">L</span><span class="special">>(</span><span class="identifier">f</span><span class="special">)</span></code> calls
|
<code class="computeroutput"><span class="identifier">mp_for_each</span><span class="special"><</span><span class="identifier">L</span><span class="special">>(</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"><</span><span class="identifier">T</span><span class="special">>()</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.
|
of the list <code class="computeroutput"><span class="identifier">L</span></code>, in order.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@@ -2504,7 +2504,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
<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>
|
<td align="right"><div class="copyright-footer"></div></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
<hr>
|
<hr>
|
||||||
|
@@ -284,7 +284,7 @@ is `mp_size<L>`.
|
|||||||
[section `mp_for_each<L>(f)`]
|
[section `mp_for_each<L>(f)`]
|
||||||
template<class L, class F> constexpr F mp_for_each(F&& 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)`.
|
Returns `std::forward<F>(f)`.
|
||||||
[endsect]
|
[endsect]
|
||||||
|
@@ -882,7 +882,7 @@ namespace detail
|
|||||||
template<class... T, class F> BOOST_CONSTEXPR F mp_for_each_impl( mp_list<T...>, F && f )
|
template<class... T, class F> BOOST_CONSTEXPR F mp_for_each_impl( mp_list<T...>, F && f )
|
||||||
{
|
{
|
||||||
using A = int[sizeof...(T)];
|
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 )
|
#if BOOST_WORKAROUND( BOOST_MSVC, <= 1800 )
|
||||||
|
@@ -14,8 +14,6 @@
|
|||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
using boost::mp11::mp_identity;
|
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX14_CONSTEXPR )
|
#if !defined( BOOST_NO_CXX14_CONSTEXPR )
|
||||||
# define CONSTEXPR14 constexpr
|
# define CONSTEXPR14 constexpr
|
||||||
#else
|
#else
|
||||||
@@ -26,9 +24,9 @@ struct F
|
|||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
CONSTEXPR14 void operator()( mp_identity<int> ) { s = s * 10 + 1; }
|
CONSTEXPR14 void operator()( int ) { s = s * 10 + 1; }
|
||||||
CONSTEXPR14 void operator()( mp_identity<short> ) { s = s * 10 + 2; }
|
CONSTEXPR14 void operator()( short ) { s = s * 10 + 2; }
|
||||||
CONSTEXPR14 void operator()( mp_identity<char> ) { s = s * 10 + 3; }
|
CONSTEXPR14 void operator()( char ) { s = s * 10 + 3; }
|
||||||
};
|
};
|
||||||
|
|
||||||
using boost::mp11::mp_list;
|
using boost::mp11::mp_list;
|
||||||
|
Reference in New Issue
Block a user