Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:06

0001 /*!
0002 @file
0003 Defines `boost::hana::symmetric_difference`.
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_SYMMETRIC_DIFFERENCE_HPP
0011 #define BOOST_HANA_SYMMETRIC_DIFFERENCE_HPP
0012 
0013 #include <boost/hana/fwd/symmetric_difference.hpp>
0014 
0015 #include <boost/hana/config.hpp>
0016 #include <boost/hana/core/dispatch.hpp>
0017 #include <boost/hana/difference.hpp>
0018 #include <boost/hana/union.hpp>
0019 
0020 
0021 namespace boost { namespace hana {
0022     //! @cond
0023     template <typename Xs, typename Ys>
0024     constexpr auto symmetric_difference_t::operator()(Xs&& xs, Ys&& ys) const {
0025         using S = typename hana::tag_of<Xs>::type;
0026         using SymmetricDifference = BOOST_HANA_DISPATCH_IF(symmetric_difference_impl<S>,
0027             true
0028         );
0029 
0030         return SymmetricDifference::apply(static_cast<Xs&&>(xs), static_cast<Ys&&>(ys));
0031     }
0032     //! @endcond
0033 
0034     template <typename S, bool condition>
0035     struct symmetric_difference_impl<S, when<condition>> : default_ {
0036         template <typename Xs, typename Ys>
0037         static constexpr auto apply(Xs&& xs, Ys&& ys) {
0038             return hana::union_(
0039                 hana::difference(xs, ys),
0040                 hana::difference(ys, xs)
0041             );
0042         }
0043     };
0044 }} // end namespace boost::hana
0045 
0046 #endif // !BOOST_HANA_SYMMETRIC_DIFFERENCE_HPP