source: NonGTP/Boost/boost/spirit/fusion/algorithm/remove.hpp @ 857

Revision 857, 2.0 KB checked in by igarcia, 19 years ago (diff)
Line 
1/*=============================================================================
2    Copyright (c) 2003 Joel de Guzman
3    Copyright (c) 2004 Peder Holt
4
5    Use, modification and distribution is subject to the Boost Software
6    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7    http://www.boost.org/LICENSE_1_0.txt)
8==============================================================================*/
9#if !defined(FUSION_ALGORITHM_REMOVE_HPP)
10#define FUSION_ALGORITHM_REMOVE_HPP
11
12#include <boost/spirit/fusion/sequence/filter_view.hpp>
13#include <boost/mpl/not.hpp>
14#include <boost/type_traits/is_same.hpp>
15
16namespace boost { namespace fusion
17{
18    namespace meta
19    {
20        template <typename Sequence, typename T>
21        struct remove
22        {
23            typedef filter_view<Sequence, mpl::not_<is_same<mpl::_, T> > > type;
24        };
25    }
26
27    namespace function
28    {
29        struct remove
30        {
31            template <typename Sequence, typename T>
32            struct apply : meta::remove<Sequence, T> {};
33
34            template <typename Sequence, typename T>
35            inline filter_view<
36                Sequence const
37              , mpl::not_<is_same<mpl::_, typename T::type> > >
38            operator()(Sequence const& seq, T) const
39            {
40                return filter_view<
41                    Sequence const
42                  , mpl::not_<is_same<mpl::_, BOOST_DEDUCED_TYPENAME T::type>
43                > >(seq);
44            }
45
46            template <typename Sequence, typename T>
47            inline filter_view<
48                Sequence
49              , mpl::not_<is_same<mpl::_, typename T::type> > >
50            operator()(Sequence& seq, T) const
51            {
52                return filter_view<
53                    Sequence
54                  , mpl::not_<is_same<mpl::_, BOOST_DEDUCED_TYPENAME T::type>
55                > >(seq);
56            }
57        };
58    }
59
60    function::remove const remove = function::remove();
61}}
62
63#endif
64
Note: See TracBrowser for help on using the repository browser.