#ifndef BOOST_MP11_BIND_HPP_INCLUDED #define BOOST_MP11_BIND_HPP_INCLUDED // Copyright 2017, 2018 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 namespace boost { namespace mp11 { // mp_bind_front template class F, class... T> struct mp_bind_front { // the indirection through mp_defer works around the language inability // to expand U... into a fixed parameter list of an alias template template using fn = typename mp_defer::type; }; template using mp_bind_front_q = mp_bind_front; // mp_bind_back template class F, class... T> struct mp_bind_back { template using fn = typename mp_defer::type; }; template using mp_bind_back_q = mp_bind_back; // 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; }; template class F, class... U, class... T> struct eval_bound_arg, T...> { using type = typename mp_bind_front::template fn; }; template class F, class... U, class... T> struct eval_bound_arg, T...> { using type = typename mp_bind_back::template fn; }; } // namespace detail template class F, class... T> struct mp_bind { #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, == 1915 ) private: template struct _f { using type = F::type...>; }; public: template using fn = typename _f::type; #else template using fn = F::type...>; #endif }; template using mp_bind_q = mp_bind; } // namespace mp11 } // namespace boost #endif // #ifndef BOOST_MP11_BIND_HPP_INCLUDED