File indexing completed on 2025-01-18 09:41:56
0001
0002 #ifndef BOOST_MPL_MAX_ELEMENT_HPP_INCLUDED
0003 #define BOOST_MPL_MAX_ELEMENT_HPP_INCLUDED
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include <boost/mpl/less.hpp>
0018 #include <boost/mpl/iter_fold.hpp>
0019 #include <boost/mpl/begin_end.hpp>
0020 #include <boost/mpl/if.hpp>
0021 #include <boost/mpl/deref.hpp>
0022 #include <boost/mpl/apply.hpp>
0023 #include <boost/mpl/aux_/common_name_wknd.hpp>
0024 #include <boost/mpl/aux_/na_spec.hpp>
0025
0026 namespace boost { namespace mpl {
0027
0028 BOOST_MPL_AUX_COMMON_NAME_WKND(max_element)
0029
0030 namespace aux {
0031
0032 template< typename Predicate >
0033 struct select_max
0034 {
0035 template< typename OldIterator, typename Iterator >
0036 struct apply
0037 {
0038 typedef typename apply2<
0039 Predicate
0040 , typename deref<OldIterator>::type
0041 , typename deref<Iterator>::type
0042 >::type condition_;
0043
0044 typedef typename if_<
0045 condition_
0046 , Iterator
0047 , OldIterator
0048 >::type type;
0049 };
0050 };
0051
0052 }
0053
0054
0055 template<
0056 typename BOOST_MPL_AUX_NA_PARAM(Sequence)
0057 , typename Predicate = less<_,_>
0058 >
0059 struct max_element
0060 : iter_fold<
0061 Sequence
0062 , typename begin<Sequence>::type
0063 , protect< aux::select_max<Predicate> >
0064 >
0065 {
0066 };
0067
0068 BOOST_MPL_AUX_NA_SPEC(1, max_element)
0069
0070 }}
0071
0072 #endif