2 #ifndef BOOST_MPL_UNIQUE_HPP_INCLUDED
\r
3 #define BOOST_MPL_UNIQUE_HPP_INCLUDED
\r
5 // Copyright Aleksey Gurtovoy 2000-2004
\r
6 // Copyright John R. Bandela 2000-2002
\r
8 // Distributed under the Boost Software License, Version 1.0.
\r
9 // (See accompanying file LICENSE_1_0.txt or copy at
\r
10 // http://www.boost.org/LICENSE_1_0.txt)
\r
12 // See http://www.boost.org/libs/mpl for documentation.
\r
14 // $Id: unique.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
\r
15 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
\r
16 // $Revision: 49267 $
\r
18 #include <boost/mpl/fold.hpp>
\r
19 #include <boost/mpl/reverse_fold.hpp>
\r
20 #include <boost/mpl/eval_if.hpp>
\r
21 #include <boost/mpl/and.hpp>
\r
22 #include <boost/mpl/identity.hpp>
\r
23 #include <boost/mpl/pair.hpp>
\r
24 #include <boost/mpl/apply.hpp>
\r
25 #include <boost/mpl/aux_/inserter_algorithm.hpp>
\r
26 #include <boost/mpl/aux_/na.hpp>
\r
27 #include <boost/mpl/aux_/na_spec.hpp>
\r
28 #include <boost/mpl/aux_/lambda_spec.hpp>
\r
30 namespace boost { namespace mpl {
\r
34 template< typename Predicate, typename Operation >
\r
37 template< typename Pair, typename T > struct apply
\r
39 typedef typename Pair::first seq_;
\r
40 typedef typename Pair::second prior_;
\r
41 typedef typename eval_if<
\r
42 and_< is_not_na<prior_>, apply2<Predicate,prior_,T> >
\r
44 , apply2<Operation,seq_,T>
\r
47 typedef pair<new_seq_,T> type;
\r
53 , typename Predicate
\r
57 : first< typename fold<
\r
59 , pair< typename Inserter::state,na >
\r
60 , protect< aux::unique_op<Predicate,typename Inserter::operation> >
\r
67 , typename Predicate
\r
70 struct reverse_unique_impl
\r
71 : first< typename reverse_fold<
\r
73 , pair< typename Inserter::state,na >
\r
74 , protect< aux::unique_op<Predicate,typename Inserter::operation> >
\r
81 BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, unique)
\r
85 #endif // BOOST_MPL_UNIQUE_HPP_INCLUDED
\r