diff --git a/doc/mp11/utility.adoc b/doc/mp11/utility.adoc index b7e785b..c9399f7 100644 --- a/doc/mp11/utility.adoc +++ b/doc/mp11/utility.adoc @@ -206,28 +206,28 @@ using R1 = mp_transform_q, L1>; // mp_list ``` -## mp_invoke +## mp_invoke_q - template using mp_invoke = typename Q::template fn; + template using mp_invoke_q = typename Q::template fn; -`mp_invoke` evaluates the nested template `fn` of a quoted metafunction. `mp_invoke, T...>` returns `F`. +`mp_invoke_q` evaluates the nested template `fn` of a quoted metafunction. `mp_invoke_q, T...>` returns `F`. -.Using mp_invoke to invoke a list of metafunctions, technique 1 +.Using mp_invoke_q to invoke a list of metafunctions, technique 1 ``` using LQ = mp_list, mp_quote>; template using is_const_and_volatile = - mp_all>>; + mp_all>>; ``` -.Using mp_invoke to invoke a list of metafunctions, technique 2 +.Using mp_invoke_q to invoke a list of metafunctions, technique 2 ``` template using is_const_and_volatile = - mp_all, LQ>>; + mp_all, LQ>>; ``` -.Using mp_invoke to invoke a list of metafunctions, technique 3 +.Using mp_invoke_q to invoke a list of metafunctions, technique 3 ``` template using is_const_and_volatile = - mp_all>>; + mp_all>>; ``` diff --git a/include/boost/mp11/algorithm.hpp b/include/boost/mp11/algorithm.hpp index 5b04a17..ff4f4d2 100644 --- a/include/boost/mp11/algorithm.hpp +++ b/include/boost/mp11/algorithm.hpp @@ -156,12 +156,12 @@ template class P, template class F, class... L> str #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) - template struct _f_ { using type = mp_eval_if_q>, mp_first>, Qf, U...>; }; + template struct _f_ { using type = mp_eval_if_q>, mp_first>, Qf, U...>; }; template using _f = typename _f_::type; #else - template using _f = mp_eval_if_q>, mp_first>, Qf, U...>; + template using _f = mp_eval_if_q>, mp_first>, Qf, U...>; #endif diff --git a/include/boost/mp11/utility.hpp b/include/boost/mp11/utility.hpp index e19ec8e..607bb4d 100644 --- a/include/boost/mp11/utility.hpp +++ b/include/boost/mp11/utility.hpp @@ -187,25 +187,25 @@ template class F> struct mp_quote_trait template using fn = typename F::type; }; -// mp_invoke +// mp_invoke_q #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 ) namespace detail { -template struct mp_invoke_impl: mp_defer {}; +template struct mp_invoke_q_impl: mp_defer {}; } // namespace detail -template using mp_invoke = typename detail::mp_invoke_impl::type; +template using mp_invoke_q = typename detail::mp_invoke_q_impl::type; #elif BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 50000 ) -template using mp_invoke = typename mp_defer::type; +template using mp_invoke_q = typename mp_defer::type; #else -template using mp_invoke = typename Q::template fn; +template using mp_invoke_q = typename Q::template fn; #endif diff --git a/test/Jamfile b/test/Jamfile index 5c9d59a..91bc4c1 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -110,8 +110,8 @@ run mp_eval_if_sf.cpp ; run mp_valid.cpp ; run mp_defer.cpp ; run mp_quote.cpp ; -run mp_invoke.cpp ; -run mp_invoke_sf.cpp ; +run mp_invoke_q.cpp ; +run mp_invoke_q_sf.cpp ; run mp_quote_trait.cpp ; run mp_cond.cpp ; run mp_cond_sf.cpp ; diff --git a/test/mp_invoke.cpp b/test/mp_invoke.cpp deleted file mode 100644 index 766e6bd..0000000 --- a/test/mp_invoke.cpp +++ /dev/null @@ -1,63 +0,0 @@ - -// Copyright 2015, 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 -#include -#include - -using boost::mp11::mp_invoke; -using boost::mp11::mp_size_t; - -struct Q1 -{ - template using fn = void; -}; - -struct Q2 -{ - template class fn; -}; - -struct Q3 -{ - template using fn = mp_size_t; -}; - -struct Q4 -{ - template using fn = T1; -}; - -struct Q5 -{ - template using fn = T2; -}; - -int main() -{ - BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); - - BOOST_TEST_TRAIT_TRUE((std::is_same, Q2::fn<>>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, Q2::fn>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, Q2::fn>)); - - BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<0>>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<1>>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<2>>)); - - BOOST_TEST_TRAIT_TRUE((std::is_same, int>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, int[]>)); - - BOOST_TEST_TRAIT_TRUE((std::is_same, float>)); - - return boost::report_errors(); -} diff --git a/test/mp_invoke_q.cpp b/test/mp_invoke_q.cpp new file mode 100644 index 0000000..777f44b --- /dev/null +++ b/test/mp_invoke_q.cpp @@ -0,0 +1,63 @@ + +// Copyright 2015, 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 +#include +#include + +using boost::mp11::mp_invoke_q; +using boost::mp11::mp_size_t; + +struct Q1 +{ + template using fn = void; +}; + +struct Q2 +{ + template class fn; +}; + +struct Q3 +{ + template using fn = mp_size_t; +}; + +struct Q4 +{ + template using fn = T1; +}; + +struct Q5 +{ + template using fn = T2; +}; + +int main() +{ + BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same, Q2::fn<>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, Q2::fn>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, Q2::fn>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<0>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<1>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<2>>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same, int>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, int[]>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same, float>)); + + return boost::report_errors(); +} diff --git a/test/mp_invoke_sf.cpp b/test/mp_invoke_q_sf.cpp similarity index 52% rename from test/mp_invoke_sf.cpp rename to test/mp_invoke_q_sf.cpp index 1e0152a..26e2912 100644 --- a/test/mp_invoke_sf.cpp +++ b/test/mp_invoke_q_sf.cpp @@ -12,7 +12,7 @@ #include #include -using boost::mp11::mp_invoke; +using boost::mp11::mp_invoke_q; using boost::mp11::mp_quote; using boost::mp11::mp_quote_trait; using boost::mp11::mp_valid; @@ -21,24 +21,24 @@ using boost::mp11::mp_identity_t; int main() { - BOOST_TEST_TRAIT_FALSE((mp_valid)); - BOOST_TEST_TRAIT_FALSE((mp_valid)); - BOOST_TEST_TRAIT_FALSE((mp_valid)); - BOOST_TEST_TRAIT_FALSE((mp_valid)); + BOOST_TEST_TRAIT_FALSE((mp_valid)); + BOOST_TEST_TRAIT_FALSE((mp_valid)); + BOOST_TEST_TRAIT_FALSE((mp_valid)); + BOOST_TEST_TRAIT_FALSE((mp_valid)); using Qi = mp_quote; - BOOST_TEST_TRAIT_FALSE((mp_valid)); - BOOST_TEST_TRAIT_TRUE((mp_valid)); - BOOST_TEST_TRAIT_FALSE((mp_valid)); + BOOST_TEST_TRAIT_FALSE((mp_valid)); + BOOST_TEST_TRAIT_TRUE((mp_valid)); + BOOST_TEST_TRAIT_FALSE((mp_valid)); using Qt = mp_quote_trait; #if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) - BOOST_TEST_TRAIT_FALSE((mp_valid)); + BOOST_TEST_TRAIT_FALSE((mp_valid)); #endif - BOOST_TEST_TRAIT_TRUE((mp_valid)); - BOOST_TEST_TRAIT_FALSE((mp_valid)); + BOOST_TEST_TRAIT_TRUE((mp_valid)); + BOOST_TEST_TRAIT_FALSE((mp_valid)); return boost::report_errors(); } diff --git a/test/mp_quote.cpp b/test/mp_quote.cpp index d98767e..62bc915 100644 --- a/test/mp_quote.cpp +++ b/test/mp_quote.cpp @@ -12,13 +12,13 @@ #include #include -using boost::mp11::mp_invoke; +using boost::mp11::mp_invoke_q; template struct X {}; template class F, class... T> using Y = X...>; -template using Z = X...>; +template using Z = X...>; template struct P {}; @@ -32,8 +32,8 @@ int main() { using Q = mp_quote; - BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, int[]>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, int[]>)); } { @@ -53,15 +53,15 @@ int main() { using Q = mp_quote

; - BOOST_TEST_TRAIT_TRUE((std::is_same, P>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, P>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, P>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, P>)); } { using Q = mp_quote; - BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, char[]>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, char[]>)); } return boost::report_errors(); diff --git a/test/mp_quote_trait.cpp b/test/mp_quote_trait.cpp index a334327..ab52bb9 100644 --- a/test/mp_quote_trait.cpp +++ b/test/mp_quote_trait.cpp @@ -16,7 +16,7 @@ int main() { using boost::mp11::mp_identity; using boost::mp11::mp_quote_trait; - using boost::mp11::mp_invoke; + using boost::mp11::mp_invoke_q; { using Q = mp_quote_trait; @@ -24,8 +24,8 @@ int main() BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); BOOST_TEST_TRAIT_TRUE((std::is_same, int[]>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, int[]>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, void>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, int[]>)); } { @@ -34,8 +34,8 @@ int main() BOOST_TEST_TRAIT_TRUE((std::is_same, void*>)); BOOST_TEST_TRAIT_TRUE((std::is_same, int(*)[]>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, void*>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, int(*)[]>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, void*>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, int(*)[]>)); } { @@ -48,8 +48,8 @@ int main() // g++ 4.7, 4.8 have difficulties with preserving top-level const - BOOST_TEST_TRAIT_TRUE((std::is_same, void const>)); - BOOST_TEST_TRAIT_TRUE((std::is_same, int const[]>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, void const>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, int const[]>)); #endif }