diff --git a/include/boost/mp11/bind.hpp b/include/boost/mp11/bind.hpp index ac257d4..fa52d2d 100644 --- a/include/boost/mp11/bind.hpp +++ b/include/boost/mp11/bind.hpp @@ -1,7 +1,7 @@ #ifndef BOOST_MP11_BIND_HPP_INCLUDED #define BOOST_MP11_BIND_HPP_INCLUDED -// Copyright 2017 Peter Dimov. +// Copyright 2017, 2018 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // @@ -17,6 +17,25 @@ 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 { @@ -54,6 +73,16 @@ template class F, class... U, class... T> struct eval_bound_a 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 @@ -63,25 +92,6 @@ template class F, class... T> struct mp_bind template using mp_bind_q = mp_bind; -// 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; - } // namespace mp11 } // namespace boost