diff --git a/include/boost/mp11/algorithm.hpp b/include/boost/mp11/algorithm.hpp index ff4f4d2..ba2b181 100644 --- a/include/boost/mp11/algorithm.hpp +++ b/include/boost/mp11/algorithm.hpp @@ -19,9 +19,10 @@ #include #include #include +#include +#include #include #include -#include #include #include @@ -427,26 +428,7 @@ template class P, class W> using mp_replace_if = typ template using mp_replace_if_q = mp_replace_if; // mp_copy_if -namespace detail -{ - -template class P> struct mp_copy_if_impl; - -template class L, class... T, template class P> struct mp_copy_if_impl, P> -{ -#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) - template struct _f { using type = mp_if, mp_list, mp_list<>>; }; - using type = mp_append, typename _f::type...>; -#else - template using _f = mp_if, mp_list, mp_list<>>; - using type = mp_append, _f...>; -#endif -}; - -} // namespace detail - -template class P> using mp_copy_if = typename detail::mp_copy_if_impl::type; -template using mp_copy_if_q = mp_copy_if; +// in detail/mp_copy_if.hpp // mp_remove namespace detail @@ -470,26 +452,7 @@ template class L, class... T, class V> struct mp_remove_impl< template using mp_remove = typename detail::mp_remove_impl::type; // mp_remove_if -namespace detail -{ - -template class P> struct mp_remove_if_impl; - -template class L, class... T, template class P> struct mp_remove_if_impl, P> -{ -#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) - template struct _f { using type = mp_if, mp_list<>, mp_list>; }; - using type = mp_append, typename _f::type...>; -#else - template using _f = mp_if, mp_list<>, mp_list>; - using type = mp_append, _f...>; -#endif -}; - -} // namespace detail - -template class P> using mp_remove_if = typename detail::mp_remove_if_impl::type; -template using mp_remove_if_q = mp_remove_if; +// in detail/mp_remove_if.hpp // mp_partition namespace detail diff --git a/include/boost/mp11/detail/mp_copy_if.hpp b/include/boost/mp11/detail/mp_copy_if.hpp new file mode 100644 index 0000000..26326b8 --- /dev/null +++ b/include/boost/mp11/detail/mp_copy_if.hpp @@ -0,0 +1,46 @@ +#ifndef BOOST_MP11_DETAIL_MP_COPY_IF_HPP_INCLUDED +#define BOOST_MP11_DETAIL_MP_COPY_IF_HPP_INCLUDED + +// Copyright 2015-2019 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 + +namespace boost +{ +namespace mp11 +{ + +// mp_copy_if +namespace detail +{ + +template class P> struct mp_copy_if_impl; + +template class L, class... T, template class P> struct mp_copy_if_impl, P> +{ +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) + template struct _f { using type = mp_if, mp_list, mp_list<>>; }; + using type = mp_append, typename _f::type...>; +#else + template using _f = mp_if, mp_list, mp_list<>>; + using type = mp_append, _f...>; +#endif +}; + +} // namespace detail + +template class P> using mp_copy_if = typename detail::mp_copy_if_impl::type; +template using mp_copy_if_q = mp_copy_if; + +} // namespace mp11 +} // namespace boost + +#endif // #ifndef BOOST_MP11_DETAIL_MP_COPY_IF_HPP_INCLUDED diff --git a/include/boost/mp11/detail/mp_remove_if.hpp b/include/boost/mp11/detail/mp_remove_if.hpp new file mode 100644 index 0000000..c0d9205 --- /dev/null +++ b/include/boost/mp11/detail/mp_remove_if.hpp @@ -0,0 +1,46 @@ +#ifndef BOOST_MP11_DETAIL_MP_REMOVE_IF_HPP_INCLUDED +#define BOOST_MP11_DETAIL_MP_REMOVE_IF_HPP_INCLUDED + +// Copyright 2015-2019 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 + +namespace boost +{ +namespace mp11 +{ + +// mp_remove_if +namespace detail +{ + +template class P> struct mp_remove_if_impl; + +template class L, class... T, template class P> struct mp_remove_if_impl, P> +{ +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) + template struct _f { using type = mp_if, mp_list<>, mp_list>; }; + using type = mp_append, typename _f::type...>; +#else + template using _f = mp_if, mp_list<>, mp_list>; + using type = mp_append, _f...>; +#endif +}; + +} // namespace detail + +template class P> using mp_remove_if = typename detail::mp_remove_if_impl::type; +template using mp_remove_if_q = mp_remove_if; + +} // namespace mp11 +} // namespace boost + +#endif // #ifndef BOOST_MP11_DETAIL_MP_REMOVE_IF_HPP_INCLUDED