mirror of
https://github.com/boostorg/hana.git
synced 2026-02-02 21:02:15 +00:00
- Split type class instances into separate files - Instances provided automatically by a type class are actually MCDs - Test each instance in a single file, not one file per method - Refactor the operator system to fix the ADL-related bug.
37 lines
977 B
C++
37 lines
977 B
C++
/*
|
|
@copyright Louis Dionne 2014
|
|
Distributed under the Boost Software License, Version 1.0.
|
|
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
|
|
*/
|
|
|
|
#include <boost/hana/comparable.hpp>
|
|
|
|
#include <boost/hana/core/is_a.hpp>
|
|
#include <boost/hana/detail/assert.hpp>
|
|
using namespace boost::hana;
|
|
|
|
|
|
int main() {
|
|
struct X { using hana_datatype = X; };
|
|
struct Y { using hana_datatype = Y; };
|
|
constexpr X x{};
|
|
constexpr Y y{};
|
|
|
|
// Two objects of different data types are unequal by default.
|
|
{
|
|
BOOST_HANA_CONSTANT_ASSERT(are<Comparable, X, Y>);
|
|
BOOST_HANA_CONSTANT_ASSERT(not_(equal(x, y)));
|
|
}
|
|
|
|
// No instance is provided when the two objects are of the same data type.
|
|
{
|
|
BOOST_HANA_CONSTANT_ASSERT(not_(are<Comparable, X, X>));
|
|
BOOST_HANA_CONSTANT_ASSERT(not_(are<Comparable, Y, Y>));
|
|
}
|
|
|
|
// laws
|
|
{
|
|
// we can't check the laws because `X` and `X` is not comparable
|
|
}
|
|
}
|