From d9c49a6cde84f41599f2114dc6fbed79670b7559 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 16 Mar 2011 21:34:08 +0000 Subject: [PATCH] Don't require explicit conversion in pairs in unordered's insert tests. In the draft standard the std::pair constructor from another pair is only considered when overloading if both members are implicitly constructible to their corresponding members. This breaks one of the unordered tests which required an explicit conversion, so change it to only require an implicit conversion. [SVN r70028] --- test/objects/test.hpp | 27 +++++++++++++++++++++++++++ test/unordered/insert_tests.cpp | 4 ++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/test/objects/test.hpp b/test/objects/test.hpp index df08c81f..44a241d2 100644 --- a/test/objects/test.hpp +++ b/test/objects/test.hpp @@ -20,11 +20,13 @@ namespace test // Note that the default hash function will work for any equal_to (but not // very well). class object; + class implicitly_convertible; class hash; class less; class equal_to; template class allocator; object generate(object const*); + implicitly_convertible generate(implicitly_convertible const*); class object : globally_counted_object { @@ -64,6 +66,31 @@ namespace test } }; + class implicitly_convertible : globally_counted_object + { + int tag1_, tag2_; + public: + + explicit implicitly_convertible(int t1 = 0, int t2 = 0) + : tag1_(t1), tag2_(t2) + {} + + operator object() const + { + return object(tag1_, tag2_); + } + + friend implicitly_convertible generate(implicitly_convertible const*) { + int* x = 0; + return implicitly_convertible(generate(x), generate(x)); + } + + friend std::ostream& operator<<(std::ostream& out, implicitly_convertible const& o) + { + return out<<"("< + std::pair > list; test::random_values< - boost::unordered_map + boost::unordered_map > v(1000, generator); list l(v.begin(), v.end());