os/ossrv/ossrv_pub/boost_apis/boost/mpl/unique.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/mpl/unique.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,85 @@
     1.4 +
     1.5 +#ifndef BOOST_MPL_UNIQUE_HPP_INCLUDED
     1.6 +#define BOOST_MPL_UNIQUE_HPP_INCLUDED
     1.7 +
     1.8 +// Copyright Aleksey Gurtovoy 2000-2004
     1.9 +// Copyright John R. Bandela 2000-2002
    1.10 +//
    1.11 +// Distributed under the Boost Software License, Version 1.0. 
    1.12 +// (See accompanying file LICENSE_1_0.txt or copy at 
    1.13 +// http://www.boost.org/LICENSE_1_0.txt)
    1.14 +//
    1.15 +// See http://www.boost.org/libs/mpl for documentation.
    1.16 +
    1.17 +// $Source: /cvsroot/boost/boost/boost/mpl/unique.hpp,v $
    1.18 +// $Date: 2004/09/02 15:40:42 $
    1.19 +// $Revision: 1.7 $
    1.20 +
    1.21 +#include <boost/mpl/fold.hpp>
    1.22 +#include <boost/mpl/reverse_fold.hpp>
    1.23 +#include <boost/mpl/eval_if.hpp>
    1.24 +#include <boost/mpl/and.hpp>
    1.25 +#include <boost/mpl/identity.hpp>
    1.26 +#include <boost/mpl/pair.hpp>
    1.27 +#include <boost/mpl/apply.hpp>
    1.28 +#include <boost/mpl/aux_/inserter_algorithm.hpp>
    1.29 +#include <boost/mpl/aux_/na.hpp>
    1.30 +#include <boost/mpl/aux_/na_spec.hpp>
    1.31 +#include <boost/mpl/aux_/lambda_spec.hpp>
    1.32 +
    1.33 +namespace boost { namespace mpl {
    1.34 +
    1.35 +namespace aux {
    1.36 +
    1.37 +template< typename Predicate, typename Operation >
    1.38 +struct unique_op
    1.39 +{
    1.40 +    template< typename Pair, typename T > struct apply
    1.41 +    {
    1.42 +        typedef typename Pair::first seq_;
    1.43 +        typedef typename Pair::second prior_;
    1.44 +        typedef typename eval_if<
    1.45 +              and_< is_not_na<prior_>, apply2<Predicate,prior_,T> >
    1.46 +            , identity<seq_>
    1.47 +            , apply2<Operation,seq_,T>
    1.48 +            >::type new_seq_;
    1.49 +
    1.50 +        typedef pair<new_seq_,T> type;
    1.51 +    };
    1.52 +};
    1.53 +
    1.54 +template<
    1.55 +      typename Sequence
    1.56 +    , typename Predicate
    1.57 +    , typename Inserter
    1.58 +    >
    1.59 +struct unique_impl
    1.60 +    : first< typename fold<
    1.61 +          Sequence
    1.62 +        , pair< typename Inserter::state,na >
    1.63 +        , protect< aux::unique_op<Predicate,typename Inserter::operation> >
    1.64 +        >::type >
    1.65 +{
    1.66 +};
    1.67 +
    1.68 +template<
    1.69 +      typename Sequence
    1.70 +    , typename Predicate
    1.71 +    , typename Inserter
    1.72 +    >
    1.73 +struct reverse_unique_impl
    1.74 +    : first< typename reverse_fold<
    1.75 +          Sequence
    1.76 +        , pair< typename Inserter::state,na >
    1.77 +        , protect< aux::unique_op<Predicate,typename Inserter::operation> >
    1.78 +        >::type >
    1.79 +{
    1.80 +};
    1.81 +
    1.82 +} // namespace aux
    1.83 +
    1.84 +BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, unique)
    1.85 +
    1.86 +}}
    1.87 +
    1.88 +#endif // BOOST_MPL_UNIQUE_HPP_INCLUDED