]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/include/boost/hana/fwd/is_subset.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / fwd / is_subset.hpp
1 /*!
2 @file
3 Forward declares `boost::hana::is_subset`.
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_IS_SUBSET_HPP
11 #define BOOST_HANA_FWD_IS_SUBSET_HPP
12
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
15
16 #include <boost/hana/functional/infix.hpp>
17
18
19 BOOST_HANA_NAMESPACE_BEGIN
20 //! Returns whether a structure contains a subset of the keys of
21 //! another structure.
22 //! @ingroup group-Searchable
23 //!
24 //! Given two `Searchable`s `xs` and `ys`, `is_subset` returns a `Logical`
25 //! representing whether `xs` is a subset of `ys`. In other words, it
26 //! returns whether all the keys of `xs` are also present in `ys`. This
27 //! method does not return whether `xs` is a _strict_ subset of `ys`; if
28 //! `xs` and `ys` are equal, all the keys of `xs` are also present in
29 //! `ys`, and `is_subset` returns true.
30 //!
31 //! @note
32 //! For convenience, `is_subset` can also be applied in infix notation.
33 //!
34 //!
35 //! Cross-type version of the method
36 //! --------------------------------
37 //! This method is tag-dispatched using the tags of both arguments.
38 //! It can be called with any two `Searchable`s sharing a common
39 //! `Searchable` embedding, as defined in the main documentation
40 //! of the `Searchable` concept. When `Searchable`s with two different
41 //! tags but sharing a common embedding are sent to `is_subset`, they
42 //! are first converted to this common `Searchable` and the `is_subset`
43 //! method of the common embedding is then used. Of course, the method
44 //! can be overriden for custom `Searchable`s for efficieny.
45 //!
46 //! @note
47 //! While cross-type dispatching for `is_subset` is supported, it is
48 //! not currently used by the library because there are no models
49 //! of `Searchable` with a common embedding.
50 //!
51 //!
52 //! @param xs
53 //! The structure to check whether it is a subset of `ys`.
54 //!
55 //! @param ys
56 //! The structure to check whether it is a superset of `xs`.
57 //!
58 //!
59 //! Example
60 //! -------
61 //! @include example/is_subset.cpp
62 #ifdef BOOST_HANA_DOXYGEN_INVOKED
63 constexpr auto is_subset = [](auto&& xs, auto&& ys) {
64 return tag-dispatched;
65 };
66 #else
67 template <typename S1, typename S2, typename = void>
68 struct is_subset_impl : is_subset_impl<S1, S2, when<true>> { };
69
70 struct is_subset_t {
71 template <typename Xs, typename Ys>
72 constexpr auto operator()(Xs&& xs, Ys&& ys) const;
73 };
74
75 constexpr auto is_subset = hana::infix(is_subset_t{});
76 #endif
77 BOOST_HANA_NAMESPACE_END
78
79 #endif // !BOOST_HANA_FWD_IS_SUBSET_HPP