| 1 | /*! |
| 2 | @file |
| 3 | Forward declares `boost::hana::and_`. |
| 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_AND_HPP |
| 11 | #define BOOST_HANA_FWD_AND_HPP |
| 12 | |
| 13 | #include <boost/hana/config.hpp> |
| 14 | #include <boost/hana/core/when.hpp> |
| 15 | |
| 16 | |
| 17 | namespace boost { namespace hana { |
| 18 | //! Return whether all the arguments are true-valued. |
| 19 | //! @ingroup group-Logical |
| 20 | //! |
| 21 | //! `and_` can be called with one argument or more. When called with |
| 22 | //! two arguments, `and_` uses tag-dispatching to find the right |
| 23 | //! implementation. Otherwise, |
| 24 | //! @code |
| 25 | //! and_(x) == x |
| 26 | //! and_(x, y, ...z) == and_(and_(x, y), z...) |
| 27 | //! @endcode |
| 28 | //! |
| 29 | //! |
| 30 | //! Example |
| 31 | //! ------- |
| 32 | //! @include example/and.cpp |
| 33 | #ifdef BOOST_HANA_DOXYGEN_INVOKED |
| 34 | constexpr auto and_ = [](auto&& x, auto&& ...y) -> decltype(auto) { |
| 35 | return tag-dispatched; |
| 36 | }; |
| 37 | #else |
| 38 | template <typename L, typename = void> |
| 39 | struct and_impl : and_impl<L, when<true>> { }; |
| 40 | |
| 41 | struct and_t { |
| 42 | template <typename X, typename Y> |
| 43 | constexpr decltype(auto) operator()(X&& x, Y&& y) const; |
| 44 | |
| 45 | template <typename X, typename ...Y> |
| 46 | constexpr decltype(auto) operator()(X&& x, Y&& ...y) const; |
| 47 | }; |
| 48 | |
| 49 | BOOST_HANA_INLINE_VARIABLE constexpr and_t and_{}; |
| 50 | #endif |
| 51 | }} // end namespace boost::hana |
| 52 | |
| 53 | #endif // !BOOST_HANA_FWD_AND_HPP |
| 54 | |