epoc32/include/stdapis/boost/mpl/max_element.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/mpl/max_element.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,72 @@
     1.4 +
     1.5 +#ifndef BOOST_MPL_MAX_ELEMENT_HPP_INCLUDED
     1.6 +#define BOOST_MPL_MAX_ELEMENT_HPP_INCLUDED
     1.7 +
     1.8 +// Copyright Aleksey Gurtovoy 2000-2004
     1.9 +//
    1.10 +// Distributed under the Boost Software License, Version 1.0. 
    1.11 +// (See accompanying file LICENSE_1_0.txt or copy at 
    1.12 +// http://www.boost.org/LICENSE_1_0.txt)
    1.13 +//
    1.14 +// See http://www.boost.org/libs/mpl for documentation.
    1.15 +
    1.16 +// $Source: /cvsroot/boost/boost/boost/mpl/max_element.hpp,v $
    1.17 +// $Date: 2004/09/02 15:40:41 $
    1.18 +// $Revision: 1.7 $
    1.19 +
    1.20 +#include <boost/mpl/less.hpp>
    1.21 +#include <boost/mpl/iter_fold.hpp>
    1.22 +#include <boost/mpl/begin_end.hpp>
    1.23 +#include <boost/mpl/if.hpp>
    1.24 +#include <boost/mpl/deref.hpp>
    1.25 +#include <boost/mpl/apply.hpp>
    1.26 +#include <boost/mpl/aux_/common_name_wknd.hpp>
    1.27 +#include <boost/mpl/aux_/na_spec.hpp>
    1.28 +
    1.29 +namespace boost { namespace mpl {
    1.30 +
    1.31 +BOOST_MPL_AUX_COMMON_NAME_WKND(max_element)
    1.32 +
    1.33 +namespace aux {
    1.34 +
    1.35 +template< typename Predicate >
    1.36 +struct select_max
    1.37 +{
    1.38 +    template< typename OldIterator, typename Iterator >
    1.39 +    struct apply
    1.40 +    {
    1.41 +        typedef typename apply2<
    1.42 +              Predicate
    1.43 +            , typename deref<OldIterator>::type
    1.44 +            , typename deref<Iterator>::type
    1.45 +            >::type condition_;
    1.46 +
    1.47 +        typedef typename if_<
    1.48 +              condition_
    1.49 +            , Iterator
    1.50 +            , OldIterator
    1.51 +            >::type type;
    1.52 +    };
    1.53 +};
    1.54 +
    1.55 +} // namespace aux 
    1.56 +
    1.57 +
    1.58 +template<
    1.59 +      typename BOOST_MPL_AUX_NA_PARAM(Sequence)
    1.60 +    , typename Predicate = less<_,_>
    1.61 +    >
    1.62 +struct max_element
    1.63 +    : iter_fold<
    1.64 +          Sequence
    1.65 +        , typename begin<Sequence>::type
    1.66 +        , protect< aux::select_max<Predicate> >
    1.67 +        >
    1.68 +{
    1.69 +};
    1.70 +
    1.71 +BOOST_MPL_AUX_NA_SPEC(1, max_element)
    1.72 +
    1.73 +}}
    1.74 +
    1.75 +#endif // BOOST_MPL_MAX_ELEMENT_HPP_INCLUDED