]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/include/boost/hana/not_equal.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / not_equal.hpp
CommitLineData
7c673cae
FG
1/*!
2@file
3Defines `boost::hana::not_equal`.
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_NOT_EQUAL_HPP
11#define BOOST_HANA_NOT_EQUAL_HPP
12
13#include <boost/hana/fwd/not_equal.hpp>
14
15#include <boost/hana/concept/comparable.hpp>
16#include <boost/hana/config.hpp>
17#include <boost/hana/core/to.hpp>
18#include <boost/hana/core/dispatch.hpp>
19#include <boost/hana/detail/has_common_embedding.hpp>
20#include <boost/hana/detail/nested_to.hpp> // required by fwd decl
21#include <boost/hana/equal.hpp>
22#include <boost/hana/not.hpp>
23
24
25BOOST_HANA_NAMESPACE_BEGIN
26 //! @cond
27 template <typename X, typename Y>
28 constexpr auto not_equal_t::operator()(X&& x, Y&& y) const {
29 using T = typename hana::tag_of<X>::type;
30 using U = typename hana::tag_of<Y>::type;
31 using NotEqual = not_equal_impl<T, U>;
32 return NotEqual::apply(static_cast<X&&>(x), static_cast<Y&&>(y));
33 }
34 //! @endcond
35
36 template <typename T, typename U, bool condition>
37 struct not_equal_impl<T, U, when<condition>> : default_ {
38 template <typename X, typename Y>
39 static constexpr decltype(auto) apply(X&& x, Y&& y) {
40 return hana::not_(hana::equal(static_cast<X&&>(x),
41 static_cast<Y&&>(y)));
42 }
43 };
44
45 // Cross-type overload
46 template <typename T, typename U>
47 struct not_equal_impl<T, U, when<
48 detail::has_nontrivial_common_embedding<Comparable, T, U>::value
49 >> {
50 using C = typename hana::common<T, U>::type;
51 template <typename X, typename Y>
52 static constexpr decltype(auto) apply(X&& x, Y&& y) {
53 return hana::not_equal(hana::to<C>(static_cast<X&&>(x)),
54 hana::to<C>(static_cast<Y&&>(y)));
55 }
56 };
57BOOST_HANA_NAMESPACE_END
58
59#endif // !BOOST_HANA_NOT_EQUAL_HPP