]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright Louis Dionne 2013-2016 |
2 | // Distributed under the Boost Software License, Version 1.0. | |
3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | |
4 | ||
5 | #ifndef TEST_SUPPORT_EQUIVALENCE_CLASS_HPP | |
6 | #define TEST_SUPPORT_EQUIVALENCE_CLASS_HPP | |
7 | ||
8 | #include <boost/hana/fwd/equal.hpp> | |
9 | ||
10 | ||
11 | struct EquivalenceClass { }; | |
12 | ||
13 | template <typename Token, typename T> | |
14 | struct equivalence_class_impl { | |
15 | Token equivalence_class; | |
16 | T unwrap; | |
17 | using hana_tag = EquivalenceClass; | |
18 | }; | |
19 | ||
20 | template <typename Token, typename X> | |
21 | constexpr equivalence_class_impl<Token, X> equivalence_class(Token token, X x) { | |
22 | return {token, x}; | |
23 | } | |
24 | ||
25 | namespace boost { namespace hana { | |
26 | template <> | |
27 | struct equal_impl<EquivalenceClass, EquivalenceClass> { | |
28 | template <typename X, typename Y> | |
29 | static constexpr auto apply(X x, Y y) | |
30 | { return hana::equal(x.equivalence_class, y.equivalence_class); } | |
31 | }; | |
32 | }} // end namespace boost::hana | |
33 | ||
34 | #endif // !TEST_SUPPORT_EQUIVALENCE_CLASS_HPP |