Chris@16
|
1
|
Chris@16
|
2 #ifndef BOOST_MPL_REPLACE_IF_HPP_INCLUDED
|
Chris@16
|
3 #define BOOST_MPL_REPLACE_IF_HPP_INCLUDED
|
Chris@16
|
4
|
Chris@16
|
5 // Copyright Aleksey Gurtovoy 2000-2004
|
Chris@16
|
6 // Copyright John R. Bandela 2000-2002
|
Chris@16
|
7 // Copyright David Abrahams 2003-2004
|
Chris@16
|
8 //
|
Chris@16
|
9 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
10 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
11 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
12 //
|
Chris@16
|
13 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
14
|
Chris@101
|
15 // $Id$
|
Chris@101
|
16 // $Date$
|
Chris@101
|
17 // $Revision$
|
Chris@16
|
18
|
Chris@16
|
19 #include <boost/mpl/transform.hpp>
|
Chris@16
|
20 #include <boost/mpl/apply.hpp>
|
Chris@16
|
21 #include <boost/mpl/if.hpp>
|
Chris@16
|
22 #include <boost/mpl/aux_/inserter_algorithm.hpp>
|
Chris@16
|
23 #include <boost/mpl/aux_/config/forwarding.hpp>
|
Chris@16
|
24
|
Chris@16
|
25 namespace boost { namespace mpl {
|
Chris@16
|
26
|
Chris@16
|
27 namespace aux {
|
Chris@16
|
28
|
Chris@16
|
29 template< typename Predicate, typename T >
|
Chris@16
|
30 struct replace_if_op
|
Chris@16
|
31 {
|
Chris@16
|
32 template< typename U > struct apply
|
Chris@16
|
33 #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
|
Chris@16
|
34 : if_<
|
Chris@16
|
35 typename apply1<Predicate,U>::type
|
Chris@16
|
36 , T
|
Chris@16
|
37 , U
|
Chris@16
|
38 >
|
Chris@16
|
39 {
|
Chris@16
|
40 #else
|
Chris@16
|
41 {
|
Chris@16
|
42 typedef typename if_<
|
Chris@16
|
43 typename apply1<Predicate,U>::type
|
Chris@16
|
44 , T
|
Chris@16
|
45 , U
|
Chris@16
|
46 >::type type;
|
Chris@16
|
47 #endif
|
Chris@16
|
48 };
|
Chris@16
|
49 };
|
Chris@16
|
50
|
Chris@16
|
51
|
Chris@16
|
52 template<
|
Chris@16
|
53 typename Sequence
|
Chris@16
|
54 , typename Predicate
|
Chris@16
|
55 , typename T
|
Chris@16
|
56 , typename Inserter
|
Chris@16
|
57 >
|
Chris@16
|
58 struct replace_if_impl
|
Chris@16
|
59 : transform1_impl<
|
Chris@16
|
60 Sequence
|
Chris@16
|
61 , protect< aux::replace_if_op<Predicate,T> >
|
Chris@16
|
62 , Inserter
|
Chris@16
|
63 >
|
Chris@16
|
64 {
|
Chris@16
|
65 };
|
Chris@16
|
66
|
Chris@16
|
67 template<
|
Chris@16
|
68 typename Sequence
|
Chris@16
|
69 , typename Predicate
|
Chris@16
|
70 , typename T
|
Chris@16
|
71 , typename Inserter
|
Chris@16
|
72 >
|
Chris@16
|
73 struct reverse_replace_if_impl
|
Chris@16
|
74 : reverse_transform1_impl<
|
Chris@16
|
75 Sequence
|
Chris@16
|
76 , protect< aux::replace_if_op<Predicate,T> >
|
Chris@16
|
77 , Inserter
|
Chris@16
|
78 >
|
Chris@16
|
79 {
|
Chris@16
|
80 };
|
Chris@16
|
81
|
Chris@16
|
82 } // namespace aux
|
Chris@16
|
83
|
Chris@16
|
84 BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(4, replace_if)
|
Chris@16
|
85
|
Chris@16
|
86 }}
|
Chris@16
|
87
|
Chris@16
|
88 #endif // BOOST_MPL_REPLACE_IF_HPP_INCLUDED
|