]>
Commit | Line | Data |
---|---|---|
1 | /*! | |
2 | @file | |
3 | Forward declares `boost::hana::intersection`. | |
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_INTERSECTION_HPP | |
11 | #define BOOST_HANA_FWD_INTERSECTION_HPP | |
12 | ||
13 | #include <boost/hana/config.hpp> | |
14 | #include <boost/hana/core/when.hpp> | |
15 | ||
16 | ||
17 | BOOST_HANA_NAMESPACE_BEGIN | |
18 | //! Returns the intersection of two sets. | |
19 | //! @relates hana::set | |
20 | //! | |
21 | //! Given two sets `xs` and `ys`, `intersection(xs, ys)` is a new set | |
22 | //! containing exactly those elements that are present both in `xs` and | |
23 | //! in `ys`. In other words, the following holds for any object `x`: | |
24 | //! @code | |
25 | //! x ^in^ intersection(xs, ys) if and only if x ^in^ xs && x ^in^ ys | |
26 | //! @endcode | |
27 | //! | |
28 | //! | |
29 | //! @param xs, ys | |
30 | //! Two sets to intersect. | |
31 | //! | |
32 | //! | |
33 | //! Example | |
34 | //! ------- | |
35 | //! @include example/intersection.cpp | |
36 | #ifdef BOOST_HANA_DOXYGEN_INVOKED | |
37 | constexpr auto intersection = [](auto&& xs, auto&& ys) { | |
38 | return tag-dispatched; | |
39 | }; | |
40 | #else | |
41 | template <typename S, typename = void> | |
42 | struct intersection_impl : intersection_impl<S, when<true>> { }; | |
43 | ||
44 | struct intersection_t { | |
45 | template <typename Xs, typename Ys> | |
46 | constexpr auto operator()(Xs&& xs, Ys&& ys) const; | |
47 | }; | |
48 | ||
49 | constexpr intersection_t intersection{}; | |
50 | #endif | |
51 | BOOST_HANA_NAMESPACE_END | |
52 | ||
53 | #endif // !BOOST_HANA_FWD_INTERSECTION_HPP |