Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:53:04

0001 /*!
0002 @file
0003 Forward declares `boost::hana::is_subset`.
0004 
0005 Copyright Louis Dionne 2013-2022
0006 Distributed under the Boost Software License, Version 1.0.
0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0008  */
0009 
0010 #ifndef BOOST_HANA_FWD_IS_SUBSET_HPP
0011 #define BOOST_HANA_FWD_IS_SUBSET_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 #include <boost/hana/functional/infix.hpp>
0017 
0018 
0019 namespace boost { namespace hana {
0020     //! Returns whether a structure contains a subset of the keys of
0021     //! another structure.
0022     //! @ingroup group-Searchable
0023     //!
0024     //! Given two `Searchable`s `xs` and `ys`, `is_subset` returns a `Logical`
0025     //! representing whether `xs` is a subset of `ys`. In other words, it
0026     //! returns whether all the keys of `xs` are also present in `ys`. This
0027     //! method does not return whether `xs` is a _strict_ subset of `ys`; if
0028     //! `xs` and `ys` are equal, all the keys of `xs` are also present in
0029     //! `ys`, and `is_subset` returns true.
0030     //!
0031     //! @note
0032     //! For convenience, `is_subset` can also be applied in infix notation.
0033     //!
0034     //!
0035     //! Cross-type version of the method
0036     //! --------------------------------
0037     //! This method is tag-dispatched using the tags of both arguments.
0038     //! It can be called with any two `Searchable`s sharing a common
0039     //! `Searchable` embedding, as defined in the main documentation
0040     //! of the `Searchable` concept. When `Searchable`s with two different
0041     //! tags but sharing a common embedding are sent to `is_subset`, they
0042     //! are first converted to this common `Searchable` and the `is_subset`
0043     //! method of the common embedding is then used. Of course, the method
0044     //! can be overriden for custom `Searchable`s for efficieny.
0045     //!
0046     //! @note
0047     //! While cross-type dispatching for `is_subset` is supported, it is
0048     //! not currently used by the library because there are no models
0049     //! of `Searchable` with a common embedding.
0050     //!
0051     //!
0052     //! @param xs
0053     //! The structure to check whether it is a subset of `ys`.
0054     //!
0055     //! @param ys
0056     //! The structure to check whether it is a superset of `xs`.
0057     //!
0058     //!
0059     //! Example
0060     //! -------
0061     //! @include example/is_subset.cpp
0062 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0063     constexpr auto is_subset = [](auto&& xs, auto&& ys) {
0064         return tag-dispatched;
0065     };
0066 #else
0067     template <typename S1, typename S2, typename = void>
0068     struct is_subset_impl : is_subset_impl<S1, S2, when<true>> { };
0069 
0070     struct is_subset_t {
0071         template <typename Xs, typename Ys>
0072         constexpr auto operator()(Xs&& xs, Ys&& ys) const;
0073     };
0074 
0075     BOOST_HANA_INLINE_VARIABLE constexpr auto is_subset = hana::infix(is_subset_t{});
0076 #endif
0077 }} // end namespace boost::hana
0078 
0079 #endif // !BOOST_HANA_FWD_IS_SUBSET_HPP