1/*!
2@file
3Defines `boost::hana::symmetric_difference`.
4
5Copyright Louis Dionne 2013-2022
6Distributed 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_SYMMETRIC_DIFFERENCE_HPP
11#define BOOST_HANA_SYMMETRIC_DIFFERENCE_HPP
12
13#include <boost/hana/fwd/symmetric_difference.hpp>
14
15#include <boost/hana/config.hpp>
16#include <boost/hana/core/dispatch.hpp>
17#include <boost/hana/difference.hpp>
18#include <boost/hana/union.hpp>
19
20
21namespace boost { namespace hana {
22 //! @cond
23 template <typename Xs, typename Ys>
24 constexpr auto symmetric_difference_t::operator()(Xs&& xs, Ys&& ys) const {
25 using S = typename hana::tag_of<Xs>::type;
26 using SymmetricDifference = BOOST_HANA_DISPATCH_IF(symmetric_difference_impl<S>,
27 true
28 );
29
30 return SymmetricDifference::apply(static_cast<Xs&&>(xs), static_cast<Ys&&>(ys));
31 }
32 //! @endcond
33
34 template <typename S, bool condition>
35 struct symmetric_difference_impl<S, when<condition>> : default_ {
36 template <typename Xs, typename Ys>
37 static constexpr auto apply(Xs&& xs, Ys&& ys) {
38 return hana::union_(
39 hana::difference(xs, ys),
40 hana::difference(ys, xs)
41 );
42 }
43 };
44}} // end namespace boost::hana
45
46#endif // !BOOST_HANA_SYMMETRIC_DIFFERENCE_HPP
47

source code of boost/libs/hana/include/boost/hana/symmetric_difference.hpp