diff options
Diffstat (limited to 'boost/hana/fwd/set.hpp')
-rw-r--r-- | boost/hana/fwd/set.hpp | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/boost/hana/fwd/set.hpp b/boost/hana/fwd/set.hpp index 55bd72d248..7312854782 100644 --- a/boost/hana/fwd/set.hpp +++ b/boost/hana/fwd/set.hpp @@ -182,9 +182,116 @@ BOOST_HANA_NAMESPACE_BEGIN }; #endif + //! Returns the union of two sets. + //! @relates hana::set + //! + //! Given two sets `xs` and `ys`, `union_(xs, ys)` is a new set containing + //! all the elements of `xs` and all the elements of `ys`, without + //! duplicates. For any object `x`, the following holds: `x` is in + //! `hana::union_(xs, ys)` if and only if `x` is in `xs` or `x` is in `ys`. + //! + //! + //! @param xs, ys + //! Two sets to compute the union of. + //! + //! + //! Example + //! ------- + //! @include example/set/union.cpp +#ifdef BOOST_HANA_DOXYGEN_INVOKED + constexpr auto union_ = [](auto&& xs, auto&& ys) { + return tag-dispatched; + }; +#endif + + //! Returns the intersection of two sets. + //! @relates hana::set + //! + //! Given two sets `xs` and `ys`, `intersection(xs, ys)` is a new set + //! containing exactly those elements that are present both in `xs` and + //! in `ys`. + //! In other words, the following holds for any object `x`: + //! @code + //! x ^in^ intersection(xs, ys) if and only if x ^in^ xs && x ^in^ ys + //! @endcode + //! + //! + //! @param xs, ys + //! Two sets to intersect. + //! + //! + //! Example + //! ------- + //! @include example/set/intersection.cpp +#ifdef BOOST_HANA_DOXYGEN_INVOKED + constexpr auto intersection = [](auto&& xs, auto&& ys) { + return tag-dispatched; + }; +#endif //! Equivalent to `to<set_tag>`; provided for convenience. //! @relates hana::set constexpr auto to_set = to<set_tag>; + + //! Returns the set-theoretic difference of two sets. + //! @relates hana::set + //! + //! Given two sets `xs` and `ys`, `difference(xs, ys)` is a new set + //! containing all the elements of `xs` that are _not_ contained in `ys`. + //! For any object `x`, the following holds: + //! @code + //! x ^in^ difference(xs, ys) if and only if x ^in^ xs && !(x ^in^ ys) + //! @endcode + //! + //! + //! This operation is not commutative, i.e. `difference(xs, ys)` is not + //! necessarily the same as `difference(ys, xs)`. Indeed, consider the + //! case where `xs` is empty and `ys` isn't. Then, `difference(xs, ys)` + //! is empty but `difference(ys, xs)` is equal to `ys`. For the symmetric + //! version of this operation, see `symmetric_difference`. + //! + //! + //! @param xs + //! A set param to remove values from. + //! + //! @param ys + //! The set whose values are removed from `xs`. + //! + //! + //! Example + //! ------- + //! @include example/set/difference.cpp +#ifdef BOOST_HANA_DOXYGEN_INVOKED + constexpr auto difference = [](auto&& xs, auto&& ys) { + return tag-dispatched; +}; +#endif + + //! Returns the symmetric set-theoretic difference of two sets. + //! @relates hana::set + //! + //! Given two sets `xs` and `ys`, `symmetric_difference(xs, ys)` is a new + //! set containing all the elements of `xs` that are not contained in `ys`, + //! and all the elements of `ys` that are not contained in `xs`. The + //! symmetric difference of two sets satisfies the following: + //! @code + //! symmetric_difference(xs, ys) == union_(difference(xs, ys), difference(ys, xs)) + //! @endcode + //! + //! + //! @param xs, ys + //! Two sets to compute the symmetric difference of. + //! + //! + //! Example + //! ------- + //! @include example/set/symmetric_difference.cpp +#ifdef BOOST_HANA_DOXYGEN_INVOKED +constexpr auto symmetric_difference = [](auto&& xs, auto&& ys) { + return tag-dispatched; + }; +#endif + + BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_FWD_SET_HPP |