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