3 Forward declares `boost::hana::contains` and `boost::hana::in`.
5 @copyright Louis Dionne 2013-2017
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)
10 #ifndef BOOST_HANA_FWD_CONTAINS_HPP
11 #define BOOST_HANA_FWD_CONTAINS_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
15 #include <boost/hana/functional/flip.hpp>
16 #include <boost/hana/functional/infix.hpp>
19 BOOST_HANA_NAMESPACE_BEGIN
20 //! Returns whether the key occurs in the structure.
21 //! @ingroup group-Searchable
23 //! Given a `Searchable` structure `xs` and a `key`, `contains` returns
24 //! whether any of the keys of the structure is equal to the given `key`.
25 //! If the structure is not finite, an equal key has to appear at a finite
26 //! position in the structure for this method to finish. For convenience,
27 //! `contains` can also be applied in infix notation.
31 //! The structure to search.
34 //! A key to be searched for in the structure. The key has to be
35 //! `Comparable` with the other keys of the structure.
40 //! @include example/contains.cpp
41 #ifdef BOOST_HANA_DOXYGEN_INVOKED
42 constexpr auto contains = [](auto&& xs, auto&& key) {
43 return tag-dispatched;
46 template <typename S, typename = void>
47 struct contains_impl : contains_impl<S, when<true>> { };
50 template <typename Xs, typename Key>
51 constexpr auto operator()(Xs&& xs, Key&& key) const;
54 constexpr auto contains = hana::infix(contains_t{});
57 //! Return whether the key occurs in the structure.
58 //! @ingroup group-Searchable
60 //! Specifically, this is equivalent to `contains`, except `in` takes its
61 //! arguments in reverse order. Like `contains`, `in` can also be applied
62 //! in infix notation for increased expressiveness. This function is not a
63 //! method that can be overriden; it is just a convenience function
64 //! provided with the concept.
69 //! @include example/in.cpp
70 constexpr auto in = hana::infix(hana::flip(hana::contains));
71 BOOST_HANA_NAMESPACE_END
73 #endif // !BOOST_HANA_FWD_CONTAINS_HPP