From 9fbf51bbcb6144b84915731bb6b0fd3b1e475719 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 12 May 2017 19:43:03 +0300 Subject: [PATCH] Remove bind_front functionality from mp_quote --- doc/html/mp11.html | 24 ++++++++++---------- doc/mp11/utility.qbk | 11 +++++----- include/boost/mp11/utility.hpp | 11 +++------- test/mp_quote.cpp | 40 ++++++++++------------------------ 4 files changed, 30 insertions(+), 56 deletions(-) diff --git a/doc/html/mp11.html b/doc/html/mp11.html index 1c96c26..17487f5 100644 --- a/doc/html/mp11.html +++ b/doc/html/mp11.html @@ -92,7 +92,7 @@ U...>
mp_valid<F, T...>
mp_defer<F, T...>
-
mp_quote<F, T...>
+
mp_quote<F>
mp_invoke<Q, T...>
Algorithms, <boost/mp11/algorithm.hpp>
@@ -934,20 +934,19 @@
-
template<template<class...> class F, class... T> struct mp_quote
+
template<template<class...> class F> struct mp_quote
 {
-    template<class... U> using fn = F<T..., U...>;
+    template<class... T> using fn = F<T...>;
 };
 

- mp_quote<F, T...> transforms the template F into a type. In the common case mp_quote<F>, - the nested template fn - of the result is an alias for F; - otherwise, fn<U...> - is an alias for F<T..., U...>, - allowing partial application. + mp_quote<F> + transforms the template F + into a type with a nested template fn + such that fn<T...> + returns F<T...>.

@@ -958,8 +957,7 @@

mp_invoke<Q, T...> evaluates the nested template fn of a quoted metafunction. mp_invoke<mp_quote<F>, T...> - is an alias for F<T...>. - mp_invoke<mp_quote<F, T...>, U...> is an alias for F<T..., U...>. + returns F<T...>.

@@ -1868,7 +1866,7 @@ - +

Last revised: May 12, 2017 at 16:19:34 GMT

Last revised: May 12, 2017 at 16:42:29 GMT


diff --git a/doc/mp11/utility.qbk b/doc/mp11/utility.qbk index ae51f85..0052d34 100644 --- a/doc/mp11/utility.qbk +++ b/doc/mp11/utility.qbk @@ -61,20 +61,19 @@ When `mp_valid` is `mp_true`, `mp_defer` is a struct with a ne `mp_defer` is an empty struct. [endsect] -[section `mp_quote`] - template class F, class... T> struct mp_quote +[section `mp_quote`] + template class F> struct mp_quote { - template using fn = F; + template using fn = F; }; -`mp_quote` transforms the template `F` into a type. In the common case `mp_quote`, the nested template `fn` of the result is an alias for `F`; -otherwise, `fn` is an alias for `F`, allowing partial application. +`mp_quote` transforms the template `F` into a type with a nested template `fn` such that `fn` returns `F`. [endsect] [section `mp_invoke`] template using mp_invoke = typename Q::template fn; -`mp_invoke` evaluates the nested template `fn` of a quoted metafunction. `mp_invoke, T...>` is an alias for `F`. `mp_invoke, U...>` is an alias for `F`. +`mp_invoke` evaluates the nested template `fn` of a quoted metafunction. `mp_invoke, T...>` returns `F`. [endsect] [endsect] diff --git a/include/boost/mp11/utility.hpp b/include/boost/mp11/utility.hpp index c077996..e220b5f 100644 --- a/include/boost/mp11/utility.hpp +++ b/include/boost/mp11/utility.hpp @@ -106,21 +106,21 @@ struct mp_no_type template class F, class... T> using mp_defer = mp_if, detail::mp_defer_impl, detail::mp_no_type>; // mp_quote -template class F, class... T> struct mp_quote +template class F> struct mp_quote { #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1910 && BOOST_MSVC >= 1900 ) #else private: #endif - template struct _fn { using type = F; }; + template struct _fn { using type = F; }; public: // the indirection through _fn works around the language inability // to expand T... into a fixed parameter list of an alias template - template using fn = typename _fn::type; + template using fn = typename _fn::type; }; // mp_unquote @@ -132,11 +132,6 @@ template struct mp_invoke_impl using type = typename Q::template fn; }; -template class F, class... T, class... U> struct mp_invoke_impl, U...> -{ - using type = F; -}; - } // namespace detail template using mp_invoke = typename detail::mp_invoke_impl::type; diff --git a/test/mp_quote.cpp b/test/mp_quote.cpp index 29bb317..9d2ca6a 100644 --- a/test/mp_quote.cpp +++ b/test/mp_quote.cpp @@ -19,12 +19,9 @@ template class F, class... T> using Y = X...>; template using Z = X...>; -struct B {}; -struct D1: B {}; -struct D2: B {}; -struct ND {}; +template struct P {}; -template using is_base_of_t = typename std::is_base_of::type; +template using first = T; int main() { @@ -38,19 +35,6 @@ int main() BOOST_TEST_TRAIT_TRUE((std::is_same, int[]>)); } - { - using Q = mp_quote; - - BOOST_TEST_TRAIT_TRUE((std::is_same, std::is_same>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, std::is_same>)); - } - - { - using Q = mp_quote; - - BOOST_TEST_TRAIT_TRUE((std::is_same, X>)); - } - { using Q = mp_quote; @@ -68,19 +52,17 @@ int main() } { - using Q = mp_quote; + using Q = mp_quote

; -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) -#else - using R1 = Y; - BOOST_TEST_TRAIT_TRUE((std::is_same>)); -#endif + BOOST_TEST_TRAIT_TRUE((std::is_same, P>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, P>)); + } -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1910 && BOOST_MSVC >= 1900 ) -#else - using R2 = Z; - BOOST_TEST_TRAIT_TRUE((std::is_same>)); -#endif + { + using Q = mp_quote; + + BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, char[]>)); } return boost::report_errors();