Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:54

0001 #ifndef BOOST_MP11_DETAIL_MP_COPY_IF_HPP_INCLUDED
0002 #define BOOST_MP11_DETAIL_MP_COPY_IF_HPP_INCLUDED
0003 
0004 //  Copyright 2015-2019 Peter Dimov.
0005 //
0006 //  Distributed under the Boost Software License, Version 1.0.
0007 //
0008 //  See accompanying file LICENSE_1_0.txt or copy at
0009 //  http://www.boost.org/LICENSE_1_0.txt
0010 
0011 #include <boost/mp11/utility.hpp>
0012 #include <boost/mp11/detail/mp_list.hpp>
0013 #include <boost/mp11/detail/mp_append.hpp>
0014 #include <boost/mp11/detail/config.hpp>
0015 
0016 namespace boost
0017 {
0018 namespace mp11
0019 {
0020 
0021 // mp_copy_if<L, P>
0022 namespace detail
0023 {
0024 
0025 template<class L, template<class...> class P> struct mp_copy_if_impl
0026 {
0027 };
0028 
0029 template<template<class...> class L, class... T, template<class...> class P> struct mp_copy_if_impl<L<T...>, P>
0030 {
0031 #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 )
0032     template<class U> struct _f { using type = mp_if<P<U>, mp_list<U>, mp_list<>>; };
0033     using type = mp_append<L<>, typename _f<T>::type...>;
0034 #else
0035     template<class U> using _f = mp_if<P<U>, mp_list<U>, mp_list<>>;
0036     using type = mp_append<L<>, _f<T>...>;
0037 #endif
0038 };
0039 
0040 } // namespace detail
0041 
0042 template<class L, template<class...> class P> using mp_copy_if = typename detail::mp_copy_if_impl<L, P>::type;
0043 template<class L, class Q> using mp_copy_if_q = mp_copy_if<L, Q::template fn>;
0044 
0045 } // namespace mp11
0046 } // namespace boost
0047 
0048 #endif // #ifndef BOOST_MP11_DETAIL_MP_COPY_IF_HPP_INCLUDED