diff --git a/doc/mp11/algorithm.adoc b/doc/mp11/algorithm.adoc index 3724eaa..6aa718c 100644 --- a/doc/mp11/algorithm.adoc +++ b/doc/mp11/algorithm.adoc @@ -13,50 +13,6 @@ http://www.boost.org/LICENSE_1_0.txt :toc-title: :idprefix: -## mp_assign - - template using mp_assign = /*...*/; - -`mp_assign, L2>` is an alias for `L1`. That is, it replaces the elements of `L1` with those of `L2`. - -.Using mp_assign with mp_list and std::tuple -``` -using L1 = std::tuple; -using L2 = mp_list; - -using R1 = mp_assign; // std::tuple -``` - -.Using mp_assign with mp_list and std::pair -``` -using L1 = std::pair; -using L2 = mp_list; - -using R1 = mp_assign; // std::pair -``` - -.mp_assign -[cols="<.^4m,4*^.^1m",width=85%] -|=== -|*L1*|A~1~|A~2~|...|A~n~ -5+| -|*L2*|B~1~|B~2~|...|B~n~ -5+| -|*mp_assign*|B~1~|B~2~|...|B~n~ -|=== - -## mp_clear - - template using mp_clear = mp_assign>; - -`mp_clear>` is an alias for `L<>`, that is, it removes the elements of `L`. - -.Using mp_clear with std::tuple -``` -using L1 = std::tuple; -using R1 = mp_clear; // std::tuple<> -``` - ## mp_transform template class F, class... L> using mp_transform = /*...*/; diff --git a/doc/mp11/list.adoc b/doc/mp11/list.adoc index b8050bf..621ec62 100644 --- a/doc/mp11/list.adoc +++ b/doc/mp11/list.adoc @@ -79,6 +79,40 @@ using L2 = std::tuple<>; using R2 = mp_empty; // mp_true ``` +## mp_assign + + template using mp_assign = /*...*/; + +`mp_assign, L2>` is an alias for `L1`. That is, it replaces the elements of `L1` with those of `L2`. + +.Using mp_assign with mp_list and std::tuple +``` +using L1 = std::tuple; +using L2 = mp_list; + +using R1 = mp_assign; // std::tuple +``` + +.Using mp_assign with mp_list and std::pair +``` +using L1 = std::pair; +using L2 = mp_list; + +using R1 = mp_assign; // std::pair +``` + +## mp_clear + + template using mp_clear = mp_assign>; + +`mp_clear>` is an alias for `L<>`, that is, it removes the elements of `L`. + +.Using mp_clear with std::tuple +``` +using L1 = std::tuple; +using R1 = mp_clear; // std::tuple<> +``` + ## mp_front template using mp_front = /*...*/; diff --git a/include/boost/mp11/algorithm.hpp b/include/boost/mp11/algorithm.hpp index bde8092..557706a 100644 --- a/include/boost/mp11/algorithm.hpp +++ b/include/boost/mp11/algorithm.hpp @@ -29,24 +29,6 @@ namespace boost namespace mp11 { -// mp_assign -namespace detail -{ - -template struct mp_assign_impl; - -template class L1, class... T, template class L2, class... U> struct mp_assign_impl, L2> -{ - using type = L1; -}; - -} // namespace detail - -template using mp_assign = typename detail::mp_assign_impl::type; - -// mp_clear -template using mp_clear = mp_assign>; - // mp_fold forward declaration namespace detail { diff --git a/include/boost/mp11/list.hpp b/include/boost/mp11/list.hpp index 8db4679..f66d612 100644 --- a/include/boost/mp11/list.hpp +++ b/include/boost/mp11/list.hpp @@ -62,6 +62,24 @@ template using mp_size = typename detail::mp_size_impl::type; // mp_empty template using mp_empty = mp_bool< mp_size::value == 0 >; +// mp_assign +namespace detail +{ + +template struct mp_assign_impl; + +template class L1, class... T, template class L2, class... U> struct mp_assign_impl, L2> +{ + using type = L1; +}; + +} // namespace detail + +template using mp_assign = typename detail::mp_assign_impl::type; + +// mp_clear +template using mp_clear = mp_assign>; + // mp_front namespace detail { diff --git a/test/mp_assign.cpp b/test/mp_assign.cpp index 823607a..60edd0c 100644 --- a/test/mp_assign.cpp +++ b/test/mp_assign.cpp @@ -1,5 +1,5 @@ -// Copyright 2015 Peter Dimov. +// Copyright 2015, 2017 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // @@ -7,9 +7,8 @@ // http://www.boost.org/LICENSE_1_0.txt -#include -#include #include +#include #include #include #include diff --git a/test/mp_clear.cpp b/test/mp_clear.cpp index 3ecd530..9684c71 100644 --- a/test/mp_clear.cpp +++ b/test/mp_clear.cpp @@ -1,5 +1,5 @@ -// Copyright 2015 Peter Dimov. +// Copyright 2015, 2017 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // @@ -7,12 +7,10 @@ // http://www.boost.org/LICENSE_1_0.txt -#include -#include #include +#include #include #include -#include int main() {