#ifndef BOOST_MP11_TUPLE_HPP_INCLUDED #define BOOST_MP11_TUPLE_HPP_INCLUDED // Copyright 2015, 2017 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt #include #include #include #include #include #include #include #if defined(BOOST_MSVC) # pragma warning( push ) # pragma warning( disable: 4100 ) // unreferenced formal parameter 'tp' #endif namespace boost { namespace mp11 { // tuple_apply namespace detail { template BOOST_CONSTEXPR auto tuple_apply_impl( F && f, Tp && tp, integer_sequence ) -> decltype( std::forward(f)( std::get(std::forward(tp))... ) ) { return std::forward(f)( std::get(std::forward(tp))... ); } } // namespace detail template::type>::value>> BOOST_CONSTEXPR auto tuple_apply( F && f, Tp && tp ) -> decltype( detail::tuple_apply_impl( std::forward(f), std::forward(tp), Seq() ) ) { return detail::tuple_apply_impl( std::forward(f), std::forward(tp), Seq() ); } // construct_from_tuple namespace detail { template BOOST_CONSTEXPR T construct_from_tuple_impl( Tp && tp, integer_sequence ) { return T( std::get(std::forward(tp))... ); } } // namespace detail template::type>::value>> BOOST_CONSTEXPR T construct_from_tuple( Tp && tp ) { return detail::construct_from_tuple_impl( std::forward(tp), Seq() ); } // tuple_for_each namespace detail { template BOOST_CONSTEXPR F tuple_for_each_impl( Tp && tp, integer_sequence, F && f ) { using A = int[sizeof...(J)]; return (void)A{ ((void)f(std::get(std::forward(tp))), 0)... }, std::forward(f); } template BOOST_CONSTEXPR F tuple_for_each_impl( Tp && /*tp*/, integer_sequence, F && f ) { return std::forward(f); } } // namespace detail template BOOST_CONSTEXPR F tuple_for_each( Tp && tp, F && f ) { using seq = make_index_sequence::type>::value>; return detail::tuple_for_each_impl( std::forward(tp), seq(), std::forward(f) ); } } // namespace mp11 } // namespace boost #if defined(BOOST_MSVC) # pragma warning( pop ) #endif #endif // #ifndef BOOST_TUPLE_HPP_INCLUDED