forked from boostorg/container
Addd new constructors to containers, according to C++14's new constructors taking allocator arguments.
This commit is contained in:
@@ -120,6 +120,17 @@ bool default_init_test()//Test for default initialization
|
||||
return false;
|
||||
}
|
||||
}
|
||||
{
|
||||
test::default_init_allocator<int>::reset_pattern(0);
|
||||
test::default_init_allocator<int>::set_ascending(true);
|
||||
IntDefaultInitAllocVector v(Capacity, default_init, test::default_init_allocator<int>());
|
||||
typename IntDefaultInitAllocVector::iterator it = v.begin();
|
||||
//Compare with the pattern
|
||||
for(std::size_t i = 0; i != Capacity; ++i, ++it){
|
||||
if(!test::check_ascending_byte_pattern(*it))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
{
|
||||
test::default_init_allocator<int>::reset_pattern(100);
|
||||
test::default_init_allocator<int>::set_ascending(false);
|
||||
|
||||
@@ -148,6 +148,17 @@ int list_test (bool copied_allocators_equal = true)
|
||||
const int max = 100;
|
||||
typedef list_push_data_function<DoublyLinked> push_data_t;
|
||||
|
||||
{ //List(n)
|
||||
::boost::movelib::unique_ptr<MyBoostList> const pboostlist = ::boost::movelib::make_unique<MyBoostList>(100);
|
||||
::boost::movelib::unique_ptr<MyStdList> const pstdlist = ::boost::movelib::make_unique<MyStdList>(100);
|
||||
if(!test::CheckEqualContainers(*pboostlist, *pstdlist)) return 1;
|
||||
}
|
||||
{ //List(n, alloc)
|
||||
::boost::movelib::unique_ptr<MyBoostList> const pboostlist = ::boost::movelib::make_unique<MyBoostList>(100, typename MyBoostList::allocator_type());
|
||||
::boost::movelib::unique_ptr<MyStdList> const pstdlist = ::boost::movelib::make_unique<MyStdList>(100);
|
||||
if(!test::CheckEqualContainers(*pboostlist, *pstdlist)) return 1;
|
||||
}
|
||||
|
||||
::boost::movelib::unique_ptr<MyBoostList> const pboostlist = ::boost::movelib::make_unique<MyBoostList>();
|
||||
::boost::movelib::unique_ptr<MyStdList> const pstdlist = ::boost::movelib::make_unique<MyStdList>();
|
||||
|
||||
|
||||
+74
-1
@@ -133,6 +133,80 @@ int map_test()
|
||||
typedef container_detail::pair<IntType, IntType> IntPairType;
|
||||
typedef typename MyStdMap::value_type StdPairType;
|
||||
const int max = 50;
|
||||
typedef typename MyStdMap::value_type StdValueType;
|
||||
typedef typename MyStdMap::key_type StdKeyType;
|
||||
typedef typename MyStdMap::mapped_type StdMappedType;
|
||||
|
||||
|
||||
//Test construction from a range
|
||||
{
|
||||
IntPairType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType i1(i/2);
|
||||
IntType i2(i/2);
|
||||
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||
}
|
||||
|
||||
StdValueType aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
new(&aux_vect2[i])StdValueType(StdKeyType(i/2), StdMappedType(i/2));
|
||||
}
|
||||
|
||||
IntPairType aux_vect3[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType i1(i/2);
|
||||
IntType i2(i/2);
|
||||
new(&aux_vect3[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||
}
|
||||
|
||||
::boost::movelib::unique_ptr<MyBoostMap> const pboostmap = ::boost::movelib::make_unique<MyBoostMap>
|
||||
( boost::make_move_iterator(&aux_vect[0])
|
||||
, boost::make_move_iterator(&aux_vect[0] + 50), typename MyBoostMap::key_compare());
|
||||
::boost::movelib::unique_ptr<MyStdMap> const pstdmap = ::boost::movelib::make_unique<MyStdMap>
|
||||
(&aux_vect2[0], &aux_vect2[0] + 50, typename MyStdMap::key_compare());
|
||||
if(!CheckEqualContainers(*pboostmap, *pstdmap)) return 1;
|
||||
|
||||
::boost::movelib::unique_ptr<MyBoostMultiMap> const pboostmultimap = ::boost::movelib::make_unique<MyBoostMultiMap>
|
||||
( boost::make_move_iterator(&aux_vect3[0])
|
||||
, boost::make_move_iterator(&aux_vect3[0] + 50), typename MyBoostMap::key_compare());
|
||||
::boost::movelib::unique_ptr<MyStdMultiMap> const pstdmultimap = ::boost::movelib::make_unique<MyStdMultiMap>
|
||||
(&aux_vect2[0], &aux_vect2[0] + 50, typename MyStdMap::key_compare());
|
||||
if(!CheckEqualContainers(*pboostmultimap, *pstdmultimap)) return 1;
|
||||
}
|
||||
{
|
||||
IntPairType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType i1(i/2);
|
||||
IntType i2(i/2);
|
||||
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||
}
|
||||
|
||||
StdValueType aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
new(&aux_vect2[i])StdValueType(StdKeyType(i/2), StdMappedType(i/2));
|
||||
}
|
||||
|
||||
IntPairType aux_vect3[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType i1(i/2);
|
||||
IntType i2(i/2);
|
||||
new(&aux_vect3[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||
}
|
||||
|
||||
::boost::movelib::unique_ptr<MyBoostMap> const pboostmap = ::boost::movelib::make_unique<MyBoostMap>
|
||||
( boost::make_move_iterator(&aux_vect[0])
|
||||
, boost::make_move_iterator(&aux_vect[0] + 50), typename MyBoostMap::allocator_type());
|
||||
::boost::movelib::unique_ptr<MyStdMap> const pstdmap = ::boost::movelib::make_unique<MyStdMap>
|
||||
(&aux_vect2[0], &aux_vect2[0] + 50, typename MyStdMap::key_compare());
|
||||
if(!CheckEqualContainers(*pboostmap, *pstdmap)) return 1;
|
||||
|
||||
::boost::movelib::unique_ptr<MyBoostMultiMap> const pboostmultimap = ::boost::movelib::make_unique<MyBoostMultiMap>
|
||||
( boost::make_move_iterator(&aux_vect3[0])
|
||||
, boost::make_move_iterator(&aux_vect3[0] + 50), typename MyBoostMap::allocator_type());
|
||||
::boost::movelib::unique_ptr<MyStdMultiMap> const pstdmultimap = ::boost::movelib::make_unique<MyStdMultiMap>
|
||||
(&aux_vect2[0], &aux_vect2[0] + 50, typename MyStdMap::key_compare());
|
||||
if(!CheckEqualContainers(*pboostmultimap, *pstdmultimap)) return 1;
|
||||
}
|
||||
|
||||
::boost::movelib::unique_ptr<MyBoostMap> const pboostmap = ::boost::movelib::make_unique<MyBoostMap>();
|
||||
::boost::movelib::unique_ptr<MyStdMap> const pstdmap = ::boost::movelib::make_unique<MyStdMap>();
|
||||
@@ -143,7 +217,6 @@ int map_test()
|
||||
MyBoostMultiMap &boostmultimap = *pboostmultimap;
|
||||
MyStdMultiMap &stdmultimap = *pstdmultimap;
|
||||
|
||||
//Test construction from a range
|
||||
{
|
||||
//This is really nasty, but we have no other simple choice
|
||||
IntPairType aux_vect[50];
|
||||
|
||||
@@ -127,6 +127,54 @@ int set_test ()
|
||||
MyStdMultiSet &stdmultiset = *pstdmultiset;
|
||||
|
||||
//Test construction from a range
|
||||
{ //Set(beg, end, compare)
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(i/2);
|
||||
aux_vect[i] = boost::move(move_me);
|
||||
}
|
||||
int aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
aux_vect2[i] = i/2;
|
||||
}
|
||||
IntType aux_vect3[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(i/2);
|
||||
aux_vect3[i] = boost::move(move_me);
|
||||
}
|
||||
::boost::movelib::unique_ptr<MyBoostSet> const pboostset = ::boost::movelib::make_unique<MyBoostSet>
|
||||
(boost::make_move_iterator(&aux_vect[0]), boost::make_move_iterator(&aux_vect[0]+50), typename MyBoostSet::key_compare());
|
||||
::boost::movelib::unique_ptr<MyStdSet> const pstdset = ::boost::movelib::make_unique<MyStdSet>(&aux_vect2[0], &aux_vect2[0]+50);
|
||||
if(!test::CheckEqualContainers(*pboostset, *pstdset)) return 1;
|
||||
::boost::movelib::unique_ptr<MyBoostMultiSet> const pboostmultiset = ::boost::movelib::make_unique<MyBoostMultiSet>
|
||||
(boost::make_move_iterator(&aux_vect3[0]), boost::make_move_iterator(&aux_vect3[0]+50), typename MyBoostMultiSet::key_compare());
|
||||
::boost::movelib::unique_ptr<MyStdMultiSet> const pstdmultiset = ::boost::movelib::make_unique<MyStdMultiSet>(&aux_vect2[0], &aux_vect2[0]+50);
|
||||
if(!test::CheckEqualContainers(*pboostmultiset, *pstdmultiset)) return 1;
|
||||
}
|
||||
{ //Set(beg, end, alloc)
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(i/2);
|
||||
aux_vect[i] = boost::move(move_me);
|
||||
}
|
||||
int aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
aux_vect2[i] = i/2;
|
||||
}
|
||||
IntType aux_vect3[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(i/2);
|
||||
aux_vect3[i] = boost::move(move_me);
|
||||
}
|
||||
::boost::movelib::unique_ptr<MyBoostSet> const pboostset = ::boost::movelib::make_unique<MyBoostSet>
|
||||
(boost::make_move_iterator(&aux_vect[0]), boost::make_move_iterator(&aux_vect[0]+50), typename MyBoostSet::allocator_type());
|
||||
::boost::movelib::unique_ptr<MyStdSet> const pstdset = ::boost::movelib::make_unique<MyStdSet>(&aux_vect2[0], &aux_vect2[0]+50);
|
||||
if(!test::CheckEqualContainers(*pboostset, *pstdset)) return 1;
|
||||
::boost::movelib::unique_ptr<MyBoostMultiSet> const pboostmultiset = ::boost::movelib::make_unique<MyBoostMultiSet>
|
||||
(boost::make_move_iterator(&aux_vect3[0]), boost::make_move_iterator(&aux_vect3[0]+50), typename MyBoostMultiSet::allocator_type());
|
||||
::boost::movelib::unique_ptr<MyStdMultiSet> const pstdmultiset = ::boost::movelib::make_unique<MyStdMultiSet>(&aux_vect2[0], &aux_vect2[0]+50);
|
||||
if(!test::CheckEqualContainers(*pboostmultiset, *pstdmultiset)) return 1;
|
||||
}
|
||||
{
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
|
||||
@@ -113,6 +113,16 @@ int vector_test()
|
||||
if(!test_range_insertion<MyBoostVector>()){
|
||||
return 1;
|
||||
}
|
||||
{ //Vector(n)
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp = ::boost::movelib::make_unique<MyBoostVector>(100);
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp = ::boost::movelib::make_unique<MyStdVector>(100);
|
||||
if(!test::CheckEqualContainers(*boostvectorp, *stdvectorp)) return 1;
|
||||
}
|
||||
{ //Vector(n, alloc)
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp = ::boost::movelib::make_unique<MyBoostVector>(100, typename MyBoostVector::allocator_type());
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp = ::boost::movelib::make_unique<MyStdVector>(100);
|
||||
if(!test::CheckEqualContainers(*boostvectorp, *stdvectorp)) return 1;
|
||||
}
|
||||
|
||||
{
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp = ::boost::movelib::make_unique<MyBoostVector>();
|
||||
|
||||
Reference in New Issue
Block a user