From eb04f683510568f32a52fb06b07791f5cd42b746 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 7 Nov 2010 14:43:50 +0000 Subject: [PATCH] Call forward declared functions from templates in unordered tests. Borland is having some issues with the existing tests, since they call inline functions before they're defined. It might be right to, although all the other compilers are fine with it. But the test isn't really what the forward headers are intended for. Try to make the tests better represent the intent, and possibly work on Borland. [SVN r66428] --- test/unordered/fwd_map_test.cpp | 37 ++++++++++++++++++++++++--------- test/unordered/fwd_set_test.cpp | 37 ++++++++++++++++++++++++--------- 2 files changed, 54 insertions(+), 20 deletions(-) diff --git a/test/unordered/fwd_map_test.cpp b/test/unordered/fwd_map_test.cpp index 531d573c..dc2267bf 100644 --- a/test/unordered/fwd_map_test.cpp +++ b/test/unordered/fwd_map_test.cpp @@ -7,37 +7,54 @@ #include -typedef boost::unordered_map int_map; - -void call_swap(int_map& x, int_map& y) { +template +void call_swap(boost::unordered_map& x, + boost::unordered_map& y) +{ swap(x,y); } -bool call_equals(int_map& x, int_map& y) { +template +bool call_equals(boost::unordered_map& x, + boost::unordered_map& y) +{ return x == y; } -bool call_not_equals(int_map& x, int_map& y) { +template +bool call_not_equals(boost::unordered_map& x, + boost::unordered_map& y) +{ return x != y; } -typedef boost::unordered_multimap int_multimap; - -void call_swap(int_multimap& x, int_multimap& y) { +template +void call_swap(boost::unordered_multimap& x, + boost::unordered_multimap& y) +{ swap(x,y); } -bool call_equals(int_multimap& x, int_multimap& y) { +template +bool call_equals(boost::unordered_multimap& x, + boost::unordered_multimap& y) +{ return x == y; } -bool call_not_equals(int_multimap& x, int_multimap& y) { +template +bool call_not_equals(boost::unordered_multimap& x, + boost::unordered_multimap& y) +{ return x != y; } #include #include "../helpers/test.hpp" +typedef boost::unordered_map int_map; +typedef boost::unordered_multimap int_multimap; + UNORDERED_AUTO_TEST(use_map_fwd_declared_function) { int_map x, y; x[1] = 2; diff --git a/test/unordered/fwd_set_test.cpp b/test/unordered/fwd_set_test.cpp index 7fc3a8c1..4fa66b90 100644 --- a/test/unordered/fwd_set_test.cpp +++ b/test/unordered/fwd_set_test.cpp @@ -16,36 +16,53 @@ template true_type is_unordered_set_impl( boost::unordered_set*); -typedef boost::unordered_set int_set; - -void call_swap(int_set& x, int_set& y) { +template +void call_swap(boost::unordered_set& x, + boost::unordered_set& y) +{ swap(x,y); } -bool call_equals(int_set& x, int_set& y) { +template +bool call_equals(boost::unordered_set& x, + boost::unordered_set& y) +{ return x == y; } -bool call_not_equals(int_set& x, int_set& y) { +template +bool call_not_equals(boost::unordered_set& x, + boost::unordered_set& y) +{ return x != y; } -typedef boost::unordered_multiset int_multiset; - -void call_swap(int_multiset& x, int_multiset& y) { +template +void call_swap(boost::unordered_multiset& x, + boost::unordered_multiset& y) +{ swap(x,y); } -bool call_equals(int_multiset& x, int_multiset& y) { +template +bool call_equals(boost::unordered_multiset& x, + boost::unordered_multiset& y) +{ return x == y; } -bool call_not_equals(int_multiset& x, int_multiset& y) { +template +bool call_not_equals(boost::unordered_multiset& x, + boost::unordered_multiset& y) +{ return x != y; } #include "../helpers/test.hpp" +typedef boost::unordered_set int_set; +typedef boost::unordered_multiset int_multiset; + UNORDERED_AUTO_TEST(use_fwd_declared_trait_without_definition) { BOOST_TEST(sizeof(is_unordered_set_impl((int_set*) 0)) == sizeof(true_type));