// (C) Copyright 2008-2009 SDML (www.sdml.info) // // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include using namespace origin; template void test_eq(T const& a, T const& b, typename requires>::type* = 0) { using namespace origin::EqualityComparable_; ignore(a != b); // Consistency(a, b); } template void test_lt(T const& a, T const& b, typename requires>::type* = 0) { using namespace origin::LessThanComparable_; ignore(a > b); ignore(a <= b); ignore(a >= b); // Consistency(a, b); } struct foo { foo(int x) : data(x) { } bool operator==(foo const& x) const { return data == x.data; } bool operator!=(foo const& x) const { std::cout << "!=\n"; return data != x.data; } bool operator<(foo const& x) const { return data < x.data; } int data; }; bool operator>(foo const& a, foo const& b) { std::cout << ">\n"; return a.data > b.data; } namespace origin { template <> struct EqualityComparable : concept_map<> { }; template <> struct LessThanComparable : concept_map<> { }; } int main() { foo a(1), b(2); test_eq(a, b); test_lt(a, b); // typedef EqualityComparable Model; }