1 | #ifndef BOOST_MP11_DETAIL_MP_REMOVE_IF_HPP_INCLUDED |
2 | #define BOOST_MP11_DETAIL_MP_REMOVE_IF_HPP_INCLUDED |
3 | |
4 | // Copyright 2015-2019 Peter Dimov. |
5 | // |
6 | // Distributed under the Boost Software License, Version 1.0. |
7 | // |
8 | // See accompanying file LICENSE_1_0.txt or copy at |
9 | // http://www.boost.org/LICENSE_1_0.txt |
10 | |
11 | #include <boost/mp11/utility.hpp> |
12 | #include <boost/mp11/detail/mp_list.hpp> |
13 | #include <boost/mp11/detail/mp_append.hpp> |
14 | #include <boost/mp11/detail/config.hpp> |
15 | |
16 | namespace boost |
17 | { |
18 | namespace mp11 |
19 | { |
20 | |
21 | // mp_remove_if<L, P> |
22 | namespace detail |
23 | { |
24 | |
25 | template<class L, template<class...> class P> struct mp_remove_if_impl |
26 | { |
27 | }; |
28 | |
29 | template<template<class...> class L, class... T, template<class...> class P> struct mp_remove_if_impl<L<T...>, P> |
30 | { |
31 | #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) |
32 | template<class U> struct _f { using type = mp_if<P<U>, mp_list<>, mp_list<U>>; }; |
33 | using type = mp_append<L<>, typename _f<T>::type...>; |
34 | #else |
35 | template<class U> using _f = mp_if<P<U>, mp_list<>, mp_list<U>>; |
36 | using type = mp_append<L<>, _f<T>...>; |
37 | #endif |
38 | }; |
39 | |
40 | } // namespace detail |
41 | |
42 | template<class L, template<class...> class P> using mp_remove_if = typename detail::mp_remove_if_impl<L, P>::type; |
43 | template<class L, class Q> using mp_remove_if_q = mp_remove_if<L, Q::template fn>; |
44 | |
45 | } // namespace mp11 |
46 | } // namespace boost |
47 | |
48 | #endif // #ifndef BOOST_MP11_DETAIL_MP_REMOVE_IF_HPP_INCLUDED |
49 | |