forked from boostorg/mp11
Restrict msvc-12.0 to one tuple in tuple_transform
This commit is contained in:
1 parent
857ba905e4
commit
917ac15ee1
3 files changed
+73
-7
No files matched your search
@@ -89,6 +89,41 @@ template<class Tp, class F> BOOST_MP11_CONSTEXPR F tuple_for_each( Tp && tp, F &
|
||||
}
|
||||
|
||||
// tuple_transform
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<class... T> BOOST_MP11_CONSTEXPR auto tp_forward( T&&... t ) -> std::tuple<T...>
|
||||
{
|
||||
return std::tuple<T...>( std::forward<T>( t )... );
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 )
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<class F, class Tp, std::size_t... J>
|
||||
BOOST_MP11_CONSTEXPR auto tuple_transform_impl( integer_sequence<std::size_t, J...>, F const& f, Tp&& tp )
|
||||
-> decltype( tp_forward( f( std::get<J>( std::forward<Tp>(tp) ) )... ) )
|
||||
{
|
||||
return tp_forward( f( std::get<J>( std::forward<Tp>(tp) ) )... );
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class F, class Tp,
|
||||
class Seq = make_index_sequence<std::tuple_size<typename std::remove_reference<Tp>::type>::value>>
|
||||
BOOST_MP11_CONSTEXPR auto tuple_transform( F const& f, Tp&& tp )
|
||||
-> decltype( detail::tuple_transform_impl( Seq(), f, std::forward<Tp>(tp) ) )
|
||||
{
|
||||
return detail::tuple_transform_impl( Seq(), f, std::forward<Tp>(tp) );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
@@ -99,11 +134,6 @@ BOOST_MP11_CONSTEXPR auto tp_extract( Tp&&... tp )
|
||||
return std::forward_as_tuple( std::get<J>( std::forward<Tp>( tp ) )... );
|
||||
}
|
||||
|
||||
template<class... T> BOOST_MP11_CONSTEXPR auto tp_forward( T&&... t ) -> std::tuple<T...>
|
||||
{
|
||||
return std::tuple<T...>( std::forward<T>( t )... );
|
||||
}
|
||||
|
||||
template<class F, class... Tp, std::size_t... J>
|
||||
BOOST_MP11_CONSTEXPR auto tuple_transform_impl( integer_sequence<std::size_t, J...>, F const& f, Tp&&... tp )
|
||||
-> decltype( tp_forward( tuple_apply( f, tp_extract<J>( std::forward<Tp>(tp)... ) )... ) )
|
||||
@@ -135,7 +165,9 @@ BOOST_MP11_CONSTEXPR auto tuple_transform( F const& f, Tp&&... tp )
|
||||
return detail::tuple_transform_impl( Seq(), f, std::forward<Tp>(tp)... );
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1910 )
|
||||
|
||||
#endif // BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 )
|
||||
|
||||
} // namespace mp11
|
||||
} // namespace boost
|
||||
|
||||
Reference in new issue
Block a user