]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/include/boost/hana/detail/operators/orderable.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / detail / operators / orderable.hpp
CommitLineData
7c673cae
FG
1/*!
2@file
3Defines operators for Orderables.
4
5@copyright Louis Dionne 2013-2016
6Distributed under the Boost Software License, Version 1.0.
7(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
8 */
9
10#ifndef BOOST_HANA_DETAIL_OPERATORS_ORDERABLE_HPP
11#define BOOST_HANA_DETAIL_OPERATORS_ORDERABLE_HPP
12
13#include <boost/hana/config.hpp>
14#include <boost/hana/core/tag_of.hpp>
15#include <boost/hana/fwd/greater.hpp>
16#include <boost/hana/fwd/greater_equal.hpp>
17#include <boost/hana/fwd/less.hpp>
18#include <boost/hana/fwd/less_equal.hpp>
19
20#include <type_traits>
21
22
23BOOST_HANA_NAMESPACE_BEGIN namespace detail {
24 template <typename Tag>
25 struct orderable_operators {
26 static constexpr bool value = false;
27 };
28
29 namespace operators {
30 template <typename X, typename Y, typename = typename std::enable_if<
31 detail::orderable_operators<typename hana::tag_of<X>::type>::value ||
32 detail::orderable_operators<typename hana::tag_of<Y>::type>::value
33 >::type>
34 constexpr auto operator<(X&& x, Y&& y)
35 { return hana::less(static_cast<X&&>(x), static_cast<Y&&>(y)); }
36
37 template <typename X, typename Y, typename = typename std::enable_if<
38 detail::orderable_operators<typename hana::tag_of<X>::type>::value ||
39 detail::orderable_operators<typename hana::tag_of<Y>::type>::value
40 >::type>
41 constexpr auto operator>(X&& x, Y&& y)
42 { return hana::greater(static_cast<X&&>(x), static_cast<Y&&>(y)); }
43
44 template <typename X, typename Y, typename = typename std::enable_if<
45 detail::orderable_operators<typename hana::tag_of<X>::type>::value ||
46 detail::orderable_operators<typename hana::tag_of<Y>::type>::value
47 >::type>
48 constexpr auto operator<=(X&& x, Y&& y)
49 { return hana::less_equal(static_cast<X&&>(x), static_cast<Y&&>(y)); }
50
51 template <typename X, typename Y, typename = typename std::enable_if<
52 detail::orderable_operators<typename hana::tag_of<X>::type>::value ||
53 detail::orderable_operators<typename hana::tag_of<Y>::type>::value
54 >::type>
55 constexpr auto operator>=(X&& x, Y&& y)
56 { return hana::greater_equal(static_cast<X&&>(x), static_cast<Y&&>(y)); }
57 } // end namespace operators
58} BOOST_HANA_NAMESPACE_END
59
60#endif // !BOOST_HANA_DETAIL_OPERATORS_ORDERABLE_HPP