File indexing completed on 2025-01-30 09:46:50
0001 #ifndef BOOST_MP11_DETAIL_MP_MIN_ELEMENT_HPP_INCLUDED
0002 #define BOOST_MP11_DETAIL_MP_MIN_ELEMENT_HPP_INCLUDED
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <boost/mp11/detail/mp_fold.hpp>
0012 #include <boost/mp11/list.hpp>
0013 #include <boost/mp11/utility.hpp>
0014
0015 namespace boost
0016 {
0017 namespace mp11
0018 {
0019
0020
0021 namespace detail
0022 {
0023
0024 template<template<class...> class P> struct select_min
0025 {
0026 template<class T1, class T2> using fn = mp_if<P<T1, T2>, T1, T2>;
0027 };
0028
0029 }
0030
0031 template<class L, template<class...> class P> using mp_min_element = mp_fold_q<mp_rest<L>, mp_first<L>, detail::select_min<P>>;
0032 template<class L, class Q> using mp_min_element_q = mp_min_element<L, Q::template fn>;
0033
0034
0035 namespace detail
0036 {
0037
0038 template<template<class...> class P> struct select_max
0039 {
0040 template<class T1, class T2> using fn = mp_if<P<T2, T1>, T1, T2>;
0041 };
0042
0043 }
0044
0045 template<class L, template<class...> class P> using mp_max_element = mp_fold_q<mp_rest<L>, mp_first<L>, detail::select_max<P>>;
0046 template<class L, class Q> using mp_max_element_q = mp_max_element<L, Q::template fn>;
0047
0048 }
0049 }
0050
0051 #endif