// (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 // The purpose of this test to make sure that the concept_assert macro will // actually assert the filter calls based on the concepts. using namespace origin; template void print_model_result() { /* std::cout << typestr() << "::result_type <=> " << typestr() << "\n"; */ } template < typename T, typename = typename concept_assert>::type> void test_polymorphic_class() { } template < typename T, typename U, typename = typename concept_assert>::type> void test_same_type() { } template void test_lvalue_reference(typename concept_assert>::type* = 0) { } template void test_rvalue_reference(typename concept_assert>::type* = 0) { } template void test_has_destructor(typename concept_assert>::type* = 0) { } template void test_has_virtual_destructor(typename concept_assert>::type* = 0) { } template void test_has_constructor(typename concept_assert>::type* = 0) { } template void test_default_constructible(typename concept_assert>::type* = 0) { } template void test_move_constructible(typename concept_assert>::type* = 0) { } template void test_copy_constructible(typename concept_assert>::type* = 0) { } template void test_trivially_destructible(typename concept_assert>::type* = 0) { } template void test_trivially_default_constructible(typename concept_assert>::type* = 0) { } template void test_trivially_copy_constructible(typename concept_assert>::type* = 0) { } template void test_move_assignable(typename concept_assert>::type* = 0) { print_model_result>(); } template void test_copy_assignable(typename concept_assert>::type* = 0) { print_model_result>(); } template void test_trivially_copy_assignable(typename concept_assert>::type* = 0) { print_model_result>(); } template void test_has_swap(typename concept_assert>::type* = 0) { } template void test_swappable(typename concept_assert>::type* = 0) { } template void test_explicitly_convertible(typename concept_assert>::type* = 0) { } template void test_convertible(typename concept_assert>::type* = 0) { } template void test_has_equal_to(typename concept_assert>::type* = 0) { print_model_result>(); } template void test_has_less(typename concept_assert>::type* = 0) { print_model_result>(); } template void test_has_dereference(typename concept_assert>::type* = 0) { print_model_result>(); } template void test_has_address_of(typename concept_assert>::type* = 0) { print_model_result>(); } template void test_has_subscript(typename concept_assert>::type* = 0) { print_model_result>(); } template < typename F, typename = typename concept_assert>::type> void test_callable(F func) { print_model_result>(); } template < typename P, typename = typename concept_assert>::type> void test_predicate(P func) { print_model_result>(); } template < typename T, typename = typename concept_assert>::type> void test_less_than_comparable() { } template < typename T, typename = typename concept_assert>::type> void test_equality_comparable() { } template < typename T, typename = typename concept_assert>::type> void test_free_store_allocatable() { } template < typename T, typename = typename concept_assert>::type> void test_semiregular() { } template < typename T, typename = typename concept_assert>::type> void test_regular() { } struct Trivial { }; struct SemiReg { SemiReg() { } SemiReg(SemiReg&&) { } SemiReg(SemiReg const&) { } ~SemiReg() { } }; struct OstreamRef { OstreamRef(std::ostream&) { } }; struct DeletedTors { DeletedTors() = delete; DeletedTors(DeletedTors&&) = delete; DeletedTors(DeletedTors const&) = delete; ~DeletedTors() = delete; }; class PrivateTors { PrivateTors() { } PrivateTors(PrivateTors&&) { } PrivateTors(PrivateTors const&) { } ~PrivateTors() { } }; struct Poly { virtual ~Poly() { } }; // NOTE: This is currently excluded because the functional component isn't // actually IN the core libraries. // NOTE: We MUST derive from functors, otherwise, we can't find the member // operator - or we could simply assume that it's true. /* struct Call : binary_function { int operator()(int, int) { return 0; } }; */ struct AnonCall { int operator()(int, int) { return 0; } }; void call(int, int) { } /* struct Pred : binary_function { bool operator()(int, int) { return false; } }; */ struct AnonPred { bool operator()(int, int) { return false; } }; bool pred(int, int) { return false; } template struct foo { static size_t const value = sizeof(T() + U()); }; int main() { using std::cout; test_lvalue_reference(); test_rvalue_reference(); // test_rvalue_reference(); // OK test_polymorphic_class(); // test_polymorphic_class(); // OK test_same_type(); // test_same_type(); // OK test_has_destructor(); test_has_destructor(); // test_has_destructor(); // OK // test_has_destructor(); // OK test_has_virtual_destructor(); // test_has_virtual_destructor(); // OK test_trivially_destructible(); // test_trivially_destructible(); // OK test_has_constructor(); test_has_constructor(); test_has_constructor(); test_has_constructor(); test_has_constructor(); test_has_constructor(); // test_has_constructor(); // OK test_default_constructible(); test_default_constructible(); test_default_constructible(); // test_default_constructible(); // OK // test_default_constructible(); // OK test_move_constructible(); test_move_constructible(); // test_move_constructible(); // OK // test_move_constructible(); // OK test_copy_constructible(); test_copy_constructible(); // test_copy_constructible(); // OK // test_copy_constructible(); // OK test_trivially_default_constructible(); // test_trivially_default_constructible>(); // OK test_trivially_copy_constructible(); // test_trivially_copy_constructible>(); // OK test_explicitly_convertible(); // test_explicitly_convertible(); OK test_convertible(); // test_convertible(); OK // test_convertible(); OK test_move_assignable(); test_copy_assignable(); test_trivially_copy_assignable(); // test_trivially_copy_assignable>(); OK // NOTE: There is no explicit swap for builtin types unless we enable the // std::swap algorithm. // test_has_swap(); // test_has_swap(); // Yup, this actually works... // test_swappable(); test_swappable(); // OK test_has_equal_to(); // test_has_equal_to(); // OK test_has_less(); // test_has_less(); test_has_dereference(); test_has_dereference(); // test_has_dereference(); // OK test_has_address_of(); test_has_address_of(); test_has_subscript(); test_has_subscript(); // test_has_subscript(); // OK // test_callable(Call()); test_callable(AnonCall()); test_callable(call); // test_callable(5); // OK // test_predicate(Pred()); // test_predicate(AnonPred()); // test_predicate(pred); test_less_than_comparable(); // test_less_than_comparable(); // OK test_equality_comparable(); // test_equality_comparable(); OK test_free_store_allocatable(); test_semiregular(); test_semiregular(); // test_semiregular(); // OK test_regular(); // test_regular(); OK }