Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:37:40

0001 /*!
0002 @file
0003 Defines logical operators.
0004 
0005 Copyright Louis Dionne 2013-2022
0006 Distributed under the Boost Software License, Version 1.0.
0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
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     } // end namespace operators
0049 } }} // end namespace boost::hana
0050 
0051 #endif // !BOOST_HANA_DETAIL_OPERATORS_LOGICAL_HPP