3 Defines `boost::hana::symmetric_difference`.
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)
10 #ifndef BOOST_HANA_SYMMETRIC_DIFFERENCE_HPP
11 #define BOOST_HANA_SYMMETRIC_DIFFERENCE_HPP
13 #include <boost/hana/fwd/symmetric_difference.hpp>
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>
21 BOOST_HANA_NAMESPACE_BEGIN
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>,
30 return SymmetricDifference::apply(static_cast<Xs&&>(xs), static_cast<Ys&&>(ys));
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) {
39 hana::difference(xs, ys),
40 hana::difference(ys, xs)
44 BOOST_HANA_NAMESPACE_END
46 #endif // !BOOST_HANA_SYMMETRIC_DIFFERENCE_HPP