File indexing completed on 2025-01-18 09:37:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_HANA_DETAIL_OPERATORS_LOGICAL_HPP
0011 #define BOOST_HANA_DETAIL_OPERATORS_LOGICAL_HPP
0012
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/tag_of.hpp>
0015 #include <boost/hana/fwd/and.hpp>
0016 #include <boost/hana/fwd/not.hpp>
0017 #include <boost/hana/fwd/or.hpp>
0018
0019 #include <type_traits>
0020
0021
0022 namespace boost { namespace hana { namespace detail {
0023 template <typename Tag>
0024 struct logical_operators {
0025 static constexpr bool value = false;
0026 };
0027
0028 namespace operators {
0029 template <typename X, typename Y, typename = typename std::enable_if<
0030 detail::logical_operators<typename hana::tag_of<X>::type>::value ||
0031 detail::logical_operators<typename hana::tag_of<Y>::type>::value
0032 >::type>
0033 constexpr auto operator||(X&& x, Y&& y)
0034 { return hana::or_(static_cast<X&&>(x), static_cast<Y&&>(y)); }
0035
0036 template <typename X, typename Y, typename = typename std::enable_if<
0037 detail::logical_operators<typename hana::tag_of<X>::type>::value ||
0038 detail::logical_operators<typename hana::tag_of<Y>::type>::value
0039 >::type>
0040 constexpr auto operator&&(X&& x, Y&& y)
0041 { return hana::and_(static_cast<X&&>(x), static_cast<Y&&>(y)); }
0042
0043 template <typename X, typename = typename std::enable_if<
0044 detail::logical_operators<typename hana::tag_of<X>::type>::value
0045 >::type>
0046 constexpr auto operator!(X&& x)
0047 { return hana::not_(static_cast<X&&>(x)); }
0048 }
0049 } }}
0050
0051 #endif