#ifndef BOOST_MP11_BIND_HPP_INCLUDED #define BOOST_MP11_BIND_HPP_INCLUDED // Copyright 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 namespace boost { namespace mp11 { // mp_arg template struct mp_arg { template using fn = mp_at_c, I>; }; using _1 = mp_arg<0>; using _2 = mp_arg<1>; using _3 = mp_arg<2>; using _4 = mp_arg<3>; using _5 = mp_arg<4>; using _6 = mp_arg<5>; using _7 = mp_arg<6>; using _8 = mp_arg<7>; using _9 = mp_arg<8>; // mp_bind template class F, class... T> struct mp_bind; namespace detail { template struct eval_bound_arg { using type = V; }; template struct eval_bound_arg, T...> { using type = typename mp_arg::template fn; }; template class F, class... U, class... T> struct eval_bound_arg, T...> { using type = typename mp_bind::template fn; }; } // namespace detail template class F, class... T> struct mp_bind { template using fn = F::type...>; }; template using mp_bind_q = mp_bind; // mp_bind_front template class F, class... T> struct mp_bind_front { #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 && BOOST_MSVC >= 1900 ) #else private: #endif template struct _fn { using type = F; }; public: // the indirection through _fn works around the language inability // to expand U... into a fixed parameter list of an alias template template using fn = typename _fn::type; }; template using mp_bind_front_q = mp_bind_front; // mp_bind_back template class F, class... T> struct mp_bind_back { #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 && BOOST_MSVC >= 1900 ) #else private: #endif template struct _fn { using type = F; }; public: template using fn = typename _fn::type; }; template using mp_bind_back_q = mp_bind_back; } // namespace mp11 } // namespace boost #endif // #ifndef BOOST_MP11_BIND_HPP_INCLUDED