]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/hana/detail/operators/comparable.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / hana / detail / operators / comparable.hpp
CommitLineData
7c673cae
FG
1/*!
2@file
3Defines operators for Comparables.
4
b32b8144 5@copyright Louis Dionne 2013-2017
7c673cae
FG
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_COMPARABLE_HPP
11#define BOOST_HANA_DETAIL_OPERATORS_COMPARABLE_HPP
12
13#include <boost/hana/config.hpp>
14#include <boost/hana/core/tag_of.hpp>
15#include <boost/hana/fwd/equal.hpp>
16#include <boost/hana/fwd/not_equal.hpp>
17
18#include <type_traits>
19
20
1e59de90 21namespace boost { namespace hana { namespace detail {
7c673cae
FG
22 template <typename Tag>
23 struct comparable_operators {
24 static constexpr bool value = false;
25 };
26
27 namespace operators {
28 template <typename X, typename Y, typename = typename std::enable_if<
20effc67
TL
29 !detail::has_idempotent_tag<X>::value &&
30 !detail::has_idempotent_tag<Y>::value &&
31 (detail::comparable_operators<
32 typename hana::tag_of<X>::type>::value ||
33 detail::comparable_operators<
34 typename hana::tag_of<Y>::type>::value)
7c673cae
FG
35 >::type>
36 constexpr auto operator==(X&& x, Y&& y)
37 { return hana::equal(static_cast<X&&>(x), static_cast<Y&&>(y)); }
38
39 template <typename X, typename Y, typename = typename std::enable_if<
20effc67
TL
40 !detail::has_idempotent_tag<X>::value &&
41 !detail::has_idempotent_tag<Y>::value &&
42 (detail::comparable_operators<
43 typename hana::tag_of<X>::type>::value ||
44 detail::comparable_operators<
45 typename hana::tag_of<Y>::type>::value)
7c673cae
FG
46 >::type>
47 constexpr auto operator!=(X&& x, Y&& y)
48 { return hana::not_equal(static_cast<X&&>(x), static_cast<Y&&>(y)); }
49 } // end namespace operators
1e59de90 50} }} // end namespace boost::hana
7c673cae
FG
51
52#endif // !BOOST_HANA_DETAIL_OPERATORS_COMPARABLE_HPP