forked from boostorg/mp11
Add mp_bind_q, mp_bind_front(_q), mp_bind_back(_q), mp_transform_q
This commit is contained in:
@@ -80,6 +80,7 @@ template<template<class...> class F, template<class...> class L1, class... T1, t
|
||||
} // namespace detail
|
||||
|
||||
template<template<class...> class F, class... L> using mp_transform = typename detail::mp_transform_impl<F, L...>::type;
|
||||
template<class Q, class... L> using mp_transform_q = mp_transform<Q::template fn, L...>;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace boost
|
||||
namespace mp11
|
||||
{
|
||||
|
||||
// mp_arg
|
||||
template<std::size_t I> struct mp_arg
|
||||
{
|
||||
template<class... T> using fn = mp_at_c<mp_list<T...>, I>;
|
||||
@@ -31,6 +32,7 @@ using _7 = mp_arg<6>;
|
||||
using _8 = mp_arg<7>;
|
||||
using _9 = mp_arg<8>;
|
||||
|
||||
// mp_bind
|
||||
template<template<class...> class F, class... T> struct mp_bind;
|
||||
|
||||
namespace detail
|
||||
@@ -58,6 +60,45 @@ template<template<class...> class F, class... T> struct mp_bind
|
||||
template<class... U> using fn = F<typename detail::eval_bound_arg<T, U...>::type...>;
|
||||
};
|
||||
|
||||
template<class Q, class... T> using mp_bind_q = mp_bind<Q::template fn, T...>;
|
||||
|
||||
// mp_bind_front
|
||||
template<template<class...> class F, class... T> struct mp_bind_front
|
||||
{
|
||||
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1910 && BOOST_MSVC >= 1900 )
|
||||
#else
|
||||
private:
|
||||
#endif
|
||||
|
||||
template<class... U> struct _fn { using type = F<T..., U...>; };
|
||||
|
||||
public:
|
||||
|
||||
// the indirection through _fn works around the language inability
|
||||
// to expand U... into a fixed parameter list of an alias template
|
||||
|
||||
template<class... U> using fn = typename _fn<U...>::type;
|
||||
};
|
||||
|
||||
template<class Q, class... T> using mp_bind_front_q = mp_bind_front<Q::template fn, T...>;
|
||||
|
||||
// mp_bind_back
|
||||
template<template<class...> class F, class... T> struct mp_bind_back
|
||||
{
|
||||
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1910 && BOOST_MSVC >= 1900 )
|
||||
#else
|
||||
private:
|
||||
#endif
|
||||
|
||||
template<class... U> struct _fn { using type = F<U..., T...>; };
|
||||
|
||||
public:
|
||||
|
||||
template<class... U> using fn = typename _fn<U...>::type;
|
||||
};
|
||||
|
||||
template<class Q, class... T> using mp_bind_back_q = mp_bind_back<Q::template fn, T...>;
|
||||
|
||||
} // namespace mp11
|
||||
} // namespace boost
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -106,14 +108,17 @@ template<template<class...> class F, class... T> using mp_defer = mp_if<mp_valid
|
||||
// mp_quote
|
||||
template<template<class...> class F, class... T> struct mp_quote
|
||||
{
|
||||
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1910 && BOOST_MSVC >= 1900 )
|
||||
#else
|
||||
private:
|
||||
#endif
|
||||
|
||||
template<class... U> struct _fn { using type = F<T..., U...>; };
|
||||
|
||||
public:
|
||||
|
||||
// the indirection through _fn works around the language inability
|
||||
// to expand T.. to expand into a fixed parameter list of an alias template
|
||||
// to expand T... into a fixed parameter list of an alias template
|
||||
|
||||
template<class... U> using fn = typename _fn<U...>::type;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user