| 1 | /*! |
| 2 | @file |
| 3 | Forward declares `boost::hana::not_`. |
| 4 | |
| 5 | Copyright Louis Dionne 2013-2022 |
| 6 | Distributed 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_FWD_NOT_HPP |
| 11 | #define BOOST_HANA_FWD_NOT_HPP |
| 12 | |
| 13 | #include <boost/hana/config.hpp> |
| 14 | #include <boost/hana/core/when.hpp> |
| 15 | |
| 16 | |
| 17 | namespace boost { namespace hana { |
| 18 | //! Negates a `Logical`. |
| 19 | //! @ingroup group-Logical |
| 20 | //! |
| 21 | //! This method returns a `Logical` with the same tag, but whose |
| 22 | //! truth-value is negated. Specifically, `not_(x)` returns a false-valued |
| 23 | //! `Logical` if `x` is a true-valued `Logical`, and a true-valued one |
| 24 | //! otherwise. |
| 25 | //! |
| 26 | //! |
| 27 | //! Example |
| 28 | //! ------- |
| 29 | //! @include example/not.cpp |
| 30 | #ifdef BOOST_HANA_DOXYGEN_INVOKED |
| 31 | constexpr auto not_ = [](auto&& x) -> decltype(auto) { |
| 32 | return tag-dispatched; |
| 33 | }; |
| 34 | #else |
| 35 | template <typename L, typename = void> |
| 36 | struct not_impl : not_impl<L, when<true>> { }; |
| 37 | |
| 38 | struct not_t { |
| 39 | template <typename X> |
| 40 | constexpr decltype(auto) operator()(X&& x) const; |
| 41 | }; |
| 42 | |
| 43 | BOOST_HANA_INLINE_VARIABLE constexpr not_t not_{}; |
| 44 | #endif |
| 45 | }} // end namespace boost::hana |
| 46 | |
| 47 | #endif // !BOOST_HANA_FWD_NOT_HPP |
| 48 | |