Compare commits

...

3 Commits

Author SHA1 Message Date
Beman Dawes 1f71b041e9 Release 1.47.0
[SVN r73007]
2011-07-11 22:16:03 +00:00
Daniel James 3fd5635d7d Unordered: Fix some overly strict tests.
[SVN r70443]
2011-03-23 00:07:17 +00:00
Daniel James 147181530d Add copy constructors and assignment operators when using rvalue references. Fixes #5119.
[SVN r69469]
2011-03-02 08:47:34 +00:00
5 changed files with 74 additions and 41 deletions
+22
View File
@@ -160,6 +160,11 @@ namespace boost
~unordered_map() {}
#if !defined(BOOST_NO_RVALUE_REFERENCES)
unordered_map(unordered_map const& other)
: table_(other.table_)
{
}
unordered_map(unordered_map&& other)
: table_(other.table_, boost::unordered_detail::move_tag())
{
@@ -170,6 +175,12 @@ namespace boost
{
}
unordered_map& operator=(unordered_map const& x)
{
table_ = x.table_;
return *this;
}
unordered_map& operator=(unordered_map&& x)
{
table_.move(x.table_);
@@ -705,6 +716,11 @@ namespace boost
~unordered_multimap() {}
#if !defined(BOOST_NO_RVALUE_REFERENCES)
unordered_multimap(unordered_multimap const& other)
: table_(other.table_)
{
}
unordered_multimap(unordered_multimap&& other)
: table_(other.table_, boost::unordered_detail::move_tag())
{
@@ -715,6 +731,12 @@ namespace boost
{
}
unordered_multimap& operator=(unordered_multimap const& x)
{
table_ = x.table_;
return *this;
}
unordered_multimap& operator=(unordered_multimap&& x)
{
table_.move(x.table_);
+22
View File
@@ -154,6 +154,11 @@ namespace boost
~unordered_set() {}
#if !defined(BOOST_NO_RVALUE_REFERENCES)
unordered_set(unordered_set const& other)
: table_(other.table_)
{
}
unordered_set(unordered_set&& other)
: table_(other.table_, boost::unordered_detail::move_tag())
{
@@ -164,6 +169,12 @@ namespace boost
{
}
unordered_set& operator=(unordered_set const& x)
{
table_ = x.table_;
return *this;
}
unordered_set& operator=(unordered_set&& x)
{
table_.move(x.table_);
@@ -651,6 +662,11 @@ namespace boost
~unordered_multiset() {}
#if !defined(BOOST_NO_RVALUE_REFERENCES)
unordered_multiset(unordered_multiset const& other)
: table_(other.table_)
{
}
unordered_multiset(unordered_multiset&& other)
: table_(other.table_, boost::unordered_detail::move_tag())
{
@@ -661,6 +677,12 @@ namespace boost
{
}
unordered_multiset& operator=(unordered_multiset const& x)
{
table_ = x.table_;
return *this;
}
unordered_multiset& operator=(unordered_multiset&& x)
{
table_.move(x.table_);
+27 -38
View File
@@ -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 T> 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<<"("<<o.tag1_<<","<<o.tag2_<<")";
}
};
class hash
{
int type_;
@@ -279,44 +306,6 @@ namespace test
{
return x == y;
}
#if BOOST_WORKAROUND(__GNUC__, < 3)
void swap(test::object& x, test::object& y) {
test::object tmp;
tmp = x;
x = y;
y = tmp;
}
void swap(test::hash& x, test::hash& y) {
test::hash tmp;
tmp = x;
x = y;
y = tmp;
}
void swap(test::less& x, test::less& y) {
test::less tmp;
tmp = x;
x = y;
y = tmp;
}
void swap(test::equal_to& x, test::equal_to& y) {
test::equal_to tmp;
tmp = x;
x = y;
y = tmp;
}
template <class T>
void swap(test::allocator<T>& x, test::allocator<T>& y) {
test::allocator<T> tmp;
tmp = x;
x = y;
y = tmp;
}
#endif
}
#endif
+2 -2
View File
@@ -372,10 +372,10 @@ void map_insert_range_test2(X*,
std::cerr<<"map_insert_range_test2\n";
typedef test::list<
std::pair<BOOST_DEDUCED_TYPENAME X::key_type const, int>
std::pair<BOOST_DEDUCED_TYPENAME X::key_type const, test::implicitly_convertible>
> list;
test::random_values<
boost::unordered_map<BOOST_DEDUCED_TYPENAME X::key_type, int>
boost::unordered_map<BOOST_DEDUCED_TYPENAME X::key_type, test::implicitly_convertible>
> v(1000, generator);
list l(v.begin(), v.end());
+1 -1
View File
@@ -261,7 +261,7 @@ namespace unnecessary_copy_tests
// copied.
reset();
x.emplace(source<std::pair<count_copies, count_copies> >());
COPY_COUNT(2); MOVE_COUNT(0);
COPY_COUNT(2); MOVE_COUNT_RANGE(0,2);
// TODO: This doesn't work on older versions of gcc.
//count_copies part;