2 #ifndef BOOST_MPL_MAX_ELEMENT_HPP_INCLUDED
3 #define BOOST_MPL_MAX_ELEMENT_HPP_INCLUDED
5 // Copyright Aleksey Gurtovoy 2000-2004
7 // Distributed under the Boost Software License, Version 1.0.
8 // (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 // See http://www.boost.org/libs/mpl for documentation.
13 // $Source: /cvsroot/boost/boost/boost/mpl/max_element.hpp,v $
14 // $Date: 2004/09/02 15:40:41 $
17 #include <boost/mpl/less.hpp>
18 #include <boost/mpl/iter_fold.hpp>
19 #include <boost/mpl/begin_end.hpp>
20 #include <boost/mpl/if.hpp>
21 #include <boost/mpl/deref.hpp>
22 #include <boost/mpl/apply.hpp>
23 #include <boost/mpl/aux_/common_name_wknd.hpp>
24 #include <boost/mpl/aux_/na_spec.hpp>
26 namespace boost { namespace mpl {
28 BOOST_MPL_AUX_COMMON_NAME_WKND(max_element)
32 template< typename Predicate >
35 template< typename OldIterator, typename Iterator >
38 typedef typename apply2<
40 , typename deref<OldIterator>::type
41 , typename deref<Iterator>::type
56 typename BOOST_MPL_AUX_NA_PARAM(Sequence)
57 , typename Predicate = less<_,_>
62 , typename begin<Sequence>::type
63 , protect< aux::select_max<Predicate> >
68 BOOST_MPL_AUX_NA_SPEC(1, max_element)
72 #endif // BOOST_MPL_MAX_ELEMENT_HPP_INCLUDED