Warning, file /include/boost/bind/detail/tuple_for_each.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #ifndef BOOST_BIND_DETAIL_TUPLE_FOR_EACH_HPP_INCLUDED
0002 #define BOOST_BIND_DETAIL_TUPLE_FOR_EACH_HPP_INCLUDED
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <boost/bind/detail/integer_sequence.hpp>
0012 #include <boost/config.hpp>
0013 #include <utility>
0014 #include <type_traits>
0015 #include <cstddef>
0016
0017 #if defined(BOOST_MSVC)
0018 # pragma warning( push )
0019 # pragma warning( disable: 4100 )
0020 #endif
0021
0022 namespace boost
0023 {
0024 namespace _bi
0025 {
0026
0027
0028
0029 template<class F, class Tp, std::size_t... J> F tuple_for_each_impl( F&& f, Tp&& tp, integer_sequence<std::size_t, J...> )
0030 {
0031 using A = int[ 1 + sizeof...(J) ];
0032 using std::get;
0033 return (void)A{ 0, ((void)f(get<J>(std::forward<Tp>(tp))), 0)... }, std::forward<F>(f);
0034 }
0035
0036 template<class F, class Tp> F tuple_for_each( F&& f, Tp&& tp )
0037 {
0038 using seq = make_index_sequence<std::tuple_size<typename std::remove_reference<Tp>::type>::value>;
0039 return _bi::tuple_for_each_impl( std::forward<F>(f), std::forward<Tp>(tp), seq() );
0040 }
0041
0042
0043
0044 template<class F, class Tp1, class Tp2, std::size_t... J> F tuple_for_each_impl( F&& f, Tp1&& tp1, Tp2&& tp2, integer_sequence<std::size_t, J...> )
0045 {
0046 using A = int[ 1 + sizeof...(J) ];
0047 using std::get;
0048 return (void)A{ 0, ((void)f( get<J>(std::forward<Tp1>(tp1)), get<J>(std::forward<Tp2>(tp2)) ), 0)... }, std::forward<F>(f);
0049 }
0050
0051 template<class F, class Tp1, class Tp2> F tuple_for_each( F&& f, Tp1&& tp1, Tp2&& tp2 )
0052 {
0053 using seq = make_index_sequence<std::tuple_size<typename std::remove_reference<Tp1>::type>::value>;
0054 return _bi::tuple_for_each_impl( std::forward<F>(f), std::forward<Tp1>(tp1), std::forward<Tp2>(tp2), seq() );
0055 }
0056
0057 }
0058 }
0059
0060 #if defined(BOOST_MSVC)
0061 # pragma warning( pop )
0062 #endif
0063
0064 #endif