]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/include/boost/hana/fwd/contains.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / fwd / contains.hpp
1 /*!
2 @file
3 Forward declares `boost::hana::contains` and `boost::hana::in`.
4
5 @copyright Louis Dionne 2013-2016
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_CONTAINS_HPP
11 #define BOOST_HANA_FWD_CONTAINS_HPP
12
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>
17
18
19 BOOST_HANA_NAMESPACE_BEGIN
20 //! Returns whether the key occurs in the structure.
21 //! @ingroup group-Searchable
22 //!
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.
28 //!
29 //!
30 //! @param xs
31 //! The structure to search.
32 //!
33 //! @param key
34 //! A key to be searched for in the structure. The key has to be
35 //! `Comparable` with the other keys of the structure.
36 //!
37 //!
38 //! Example
39 //! -------
40 //! @include example/contains.cpp
41 #ifdef BOOST_HANA_DOXYGEN_INVOKED
42 constexpr auto contains = [](auto&& xs, auto&& key) {
43 return tag-dispatched;
44 };
45 #else
46 template <typename S, typename = void>
47 struct contains_impl : contains_impl<S, when<true>> { };
48
49 struct contains_t {
50 template <typename Xs, typename Key>
51 constexpr auto operator()(Xs&& xs, Key&& key) const;
52 };
53
54 constexpr auto contains = hana::infix(contains_t{});
55 #endif
56
57 //! Return whether the key occurs in the structure.
58 //! @ingroup group-Searchable
59 //!
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.
65 //!
66 //!
67 //! Example
68 //! -------
69 //! @include example/in.cpp
70 constexpr auto in = hana::infix(hana::flip(hana::contains));
71 BOOST_HANA_NAMESPACE_END
72
73 #endif // !BOOST_HANA_FWD_CONTAINS_HPP