/*! @file Defines `boost::hana::not_`. @copyright Louis Dionne 2013-2017 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_HANA_NOT_HPP #define BOOST_HANA_NOT_HPP #include #include #include #include #include #include #include #include BOOST_HANA_NAMESPACE_BEGIN //! @cond template constexpr decltype(auto) not_t::operator()(X&& x) const { using Bool = typename hana::tag_of::type; using Not = BOOST_HANA_DISPATCH_IF(hana::not_impl, hana::Logical::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Logical::value, "hana::not_(cond) requires 'cond' to be a Logical"); #endif return Not::apply(static_cast(x)); } //! @endcond template struct not_impl> : hana::default_ { template static constexpr auto apply(Args&& ...) = delete; }; template struct not_impl::value>> { template static constexpr Cond apply(Cond const& cond) { return static_cast(cond ? false : true); } }; namespace detail { template struct constant_from_not { static constexpr auto value = hana::not_(hana::value()); using hana_tag = detail::CanonicalConstant; }; } template struct not_impl::value && hana::Logical::value >> { template static constexpr auto apply(Cond const&) { return hana::to(detail::constant_from_not{}); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_NOT_HPP