Back to home page

EIC code displayed by LXR

 
 

    


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 //  Copyright 2015-2017 Peter Dimov.
0005 //
0006 //  Distributed under the Boost Software License, Version 1.0.
0007 //
0008 //  See accompanying file LICENSE_1_0.txt or copy at
0009 //  http://www.boost.org/LICENSE_1_0.txt
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 // mp_min_element<L, P>
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 } // namespace detail
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 // mp_max_element<L, P>
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 } // namespace detail
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 } // namespace mp11
0049 } // namespace boost
0050 
0051 #endif // #ifndef BOOST_MP11_DETAIL_MP_MIN_ELEMENT_HPP_INCLUDED