1 /*!
2 @file
3 Defines `boost::hana::difference`.
4 
5 @copyright Louis Dionne 2013-2017
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_DIFFERENCE_HPP
11 #define BOOST_HANA_DIFFERENCE_HPP
12 
13 #include <boost/hana/fwd/difference.hpp>
14 
15 #include <boost/hana/config.hpp>
16 #include <boost/hana/core/dispatch.hpp>
17 #include <boost/hana/erase_key.hpp>
18 
19 
20 BOOST_HANA_NAMESPACE_BEGIN
21     //! @cond
22     template <typename Xs, typename Ys>
operator ()(Xs && xs,Ys && ys) const23     constexpr auto difference_t::operator()(Xs&& xs, Ys&& ys) const {
24         using S = typename hana::tag_of<Xs>::type;
25         using Difference = BOOST_HANA_DISPATCH_IF(difference_impl<S>,
26             true
27         );
28 
29         return Difference::apply(static_cast<Xs&&>(xs), static_cast<Ys&&>(ys));
30     }
31     //! @endcond
32 
33     template <typename S, bool condition>
34     struct difference_impl<S, when<condition>> : default_ {
35         template <typename ...Args>
36         static constexpr auto apply(Args&& ...) = delete;
37     };
38 BOOST_HANA_NAMESPACE_END
39 
40 #endif // !BOOST_HANA_DIFFERENCE_HPP
41