small_vector: Added copy/move constructor/assignments from small_vector_base

This commit is contained in:
Ion Gaztañaga committed 2015-12-24 13:46:00 +01:00
1 parent 75f7c8fa73
commit 641d1a5d5a
4 files changed
+61 -21

No files matched your search

+1 -1
View File
@@ -88,7 +88,7 @@ class alloc_propagate_wrapper
{}
alloc_propagate_wrapper &operator=(BOOST_COPY_ASSIGN_REF(alloc_propagate_wrapper) x)
{ this->Base::operator=(x); return *this; }
{ this->Base::operator=((const Base &)x); return *this; }
alloc_propagate_wrapper &operator=(BOOST_RV_REF(alloc_propagate_wrapper) x)
{ this->Base::operator=(boost::move(static_cast<Base&>(x))); return *this; }
+27 -1
View File
@@ -96,7 +96,7 @@ bool test_small_vector_base_test()
return false;
}
{
typedef boost::container::small_vector<int, 5> sm7_t;
typedef boost::container::small_vector<int, 7> sm7_t;
sm7_t sm7;
smb_t &smb = sm7;
smb.push_back(2);
@@ -105,6 +105,32 @@ bool test_small_vector_base_test()
if (!boost::container::test::CheckEqualContainers(sm7, smb))
return false;
}
{
typedef boost::container::small_vector<int, 5> sm5_t;
sm5_t sm5;
smb_t &smb = sm5;
smb.push_back(1);
sm5_t sm5_copy(smb);
if (!boost::container::test::CheckEqualContainers(sm5, sm5_copy))
return false;
smb.push_back(2);
if(smb.size() != 2){
return false;
}
sm5_copy = smb;
if (!boost::container::test::CheckEqualContainers(sm5, sm5_copy))
return false;
sm5_t sm5_move(boost::move(smb));
smb.clear();
if (!boost::container::test::CheckEqualContainers(sm5_move, sm5_copy))
return false;
smb = sm5_copy;
sm5_move = boost::move(smb);
smb.clear();
if (!boost::container::test::CheckEqualContainers(sm5_move, sm5_copy))
return false;
}
return true;
}