]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/mp11/detail/mp_min_element.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / mp11 / detail / mp_min_element.hpp
1 #ifndef BOOST_MP11_DETAIL_MP_MIN_ELEMENT_HPP_INCLUDED
2 #define BOOST_MP11_DETAIL_MP_MIN_ELEMENT_HPP_INCLUDED
3
4 // Copyright 2015-2017 Peter Dimov.
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 //
8 // See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt
10
11 #include <boost/mp11/detail/mp_fold.hpp>
12 #include <boost/mp11/list.hpp>
13 #include <boost/mp11/utility.hpp>
14
15 namespace boost
16 {
17 namespace mp11
18 {
19
20 // mp_min_element<L, P>
21 namespace detail
22 {
23
24 template<template<class...> class P> struct select_min
25 {
26 template<class T1, class T2> using fn = mp_if<P<T1, T2>, T1, T2>;
27 };
28
29 } // namespace detail
30
31 template<class L, template<class...> class P> using mp_min_element = mp_fold_q<mp_rest<L>, mp_first<L>, detail::select_min<P>>;
32 template<class L, class Q> using mp_min_element_q = mp_min_element<L, Q::template fn>;
33
34 // mp_max_element<L, P>
35 namespace detail
36 {
37
38 template<template<class...> class P> struct select_max
39 {
40 template<class T1, class T2> using fn = mp_if<P<T2, T1>, T1, T2>;
41 };
42
43 } // namespace detail
44
45 template<class L, template<class...> class P> using mp_max_element = mp_fold_q<mp_rest<L>, mp_first<L>, detail::select_max<P>>;
46 template<class L, class Q> using mp_max_element_q = mp_max_element<L, Q::template fn>;
47
48 } // namespace mp11
49 } // namespace boost
50
51 #endif // #ifndef BOOST_MP11_DETAIL_MP_MIN_ELEMENT_HPP_INCLUDED