]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/include/boost/hana/detail/operators/logical.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / detail / operators / logical.hpp
CommitLineData
7c673cae
FG
1/*!
2@file
3Defines logical operators.
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_LOGICAL_HPP
11#define BOOST_HANA_DETAIL_OPERATORS_LOGICAL_HPP
12
13#include <boost/hana/config.hpp>
14#include <boost/hana/core/tag_of.hpp>
15#include <boost/hana/fwd/and.hpp>
16#include <boost/hana/fwd/not.hpp>
17#include <boost/hana/fwd/or.hpp>
18
19#include <type_traits>
20
21
22BOOST_HANA_NAMESPACE_BEGIN namespace detail {
23 template <typename Tag>
24 struct logical_operators {
25 static constexpr bool value = false;
26 };
27
28 namespace operators {
29 template <typename X, typename Y, typename = typename std::enable_if<
30 detail::logical_operators<typename hana::tag_of<X>::type>::value ||
31 detail::logical_operators<typename hana::tag_of<Y>::type>::value
32 >::type>
33 constexpr auto operator||(X&& x, Y&& y)
34 { return hana::or_(static_cast<X&&>(x), static_cast<Y&&>(y)); }
35
36 template <typename X, typename Y, typename = typename std::enable_if<
37 detail::logical_operators<typename hana::tag_of<X>::type>::value ||
38 detail::logical_operators<typename hana::tag_of<Y>::type>::value
39 >::type>
40 constexpr auto operator&&(X&& x, Y&& y)
41 { return hana::and_(static_cast<X&&>(x), static_cast<Y&&>(y)); }
42
43 template <typename X, typename = typename std::enable_if<
44 detail::logical_operators<typename hana::tag_of<X>::type>::value
45 >::type>
46 constexpr auto operator!(X&& x)
47 { return hana::not_(static_cast<X&&>(x)); }
48 } // end namespace operators
49} BOOST_HANA_NAMESPACE_END
50
51#endif // !BOOST_HANA_DETAIL_OPERATORS_LOGICAL_HPP