@@ -12,6 +12,7 @@ Distributed under the Boost Software License, Version 1.0.
12
12
13
13
#include < boost/hana/fwd/difference.hpp>
14
14
15
+ #include < boost/hana/concept/set_theoretic.hpp>
15
16
#include < boost/hana/config.hpp>
16
17
#include < boost/hana/core/dispatch.hpp>
17
18
#include < boost/hana/erase_key.hpp>
@@ -21,11 +22,21 @@ BOOST_HANA_NAMESPACE_BEGIN
21
22
// ! @cond
22
23
template <typename Xs, typename Ys>
23
24
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
25
+ using TX = typename hana::tag_of<Xs>::type;
26
+ using TY = typename hana::tag_of<Ys>::type;
27
+ using Difference = BOOST_HANA_DISPATCH_IF (difference_impl<TX>,
28
+ hana::SetTheoretic<TX>::value &&
29
+ std::is_same<TX, TY>::value
27
30
);
28
31
32
+ #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
33
+ static_assert (hana::SetTheoretic<TX>::value,
34
+ " hana::difference(xs, ys) requires 'xs' to be SetTheoretic" );
35
+
36
+ static_assert (std::is_same<TX, TY>::value,
37
+ " hana::difference(xs, ys) requires 'xs' and 'ys' to be of the same type" );
38
+ #endif
39
+
29
40
return Difference::apply (static_cast <Xs&&>(xs), static_cast <Ys&&>(ys));
30
41
}
31
42
// ! @endcond
0 commit comments