forked from boostorg/container
Fix Trac #11866: small_vector does not have range constructor. Added all missing constructors to small vector
This commit is contained in:
1 parent
211c474eb4
commit
b436c91590
3 files changed
+147
-47
No files matched your search
+83
-26
@@ -95,10 +95,10 @@ bool vector_copyable_only(V1&, V2&, boost::container::container_detail::false_ty
|
||||
}
|
||||
|
||||
//Function to check if both sets are equal
|
||||
template<class V1, class V2>
|
||||
bool vector_copyable_only(V1 &boostvector, V2 &stdvector, boost::container::container_detail::true_type)
|
||||
template<class MyBoostVector, class MyStdVector>
|
||||
bool vector_copyable_only(MyBoostVector &boostvector, MyStdVector &stdvector, boost::container::container_detail::true_type)
|
||||
{
|
||||
typedef typename V1::value_type IntType;
|
||||
typedef typename MyBoostVector::value_type IntType;
|
||||
std::size_t size = boostvector.size();
|
||||
boostvector.insert(boostvector.end(), 50, IntType(1));
|
||||
stdvector.insert(stdvector.end(), 50, 1);
|
||||
@@ -133,11 +133,13 @@ bool vector_copyable_only(V1 &boostvector, V2 &stdvector, boost::container::cont
|
||||
if(!test::CheckEqualContainers(boostvector, stdvector)) return false;
|
||||
}
|
||||
{ //Vector(const Vector &)
|
||||
::boost::movelib::unique_ptr<V1> const pv1 = ::boost::movelib::make_unique<V1>(boostvector);
|
||||
::boost::movelib::unique_ptr<V2> const pv2 = ::boost::movelib::make_unique<V2>(stdvector);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const pv1 =
|
||||
::boost::movelib::make_unique<MyBoostVector>(boostvector);
|
||||
::boost::movelib::unique_ptr<MyStdVector> const pv2 =
|
||||
::boost::movelib::make_unique<MyStdVector>(stdvector);
|
||||
|
||||
V1 &v1 = *pv1;
|
||||
V2 &v2 = *pv2;
|
||||
MyBoostVector &v1 = *pv1;
|
||||
MyStdVector &v2 = *pv2;
|
||||
|
||||
boostvector.clear();
|
||||
stdvector.clear();
|
||||
@@ -146,11 +148,13 @@ bool vector_copyable_only(V1 &boostvector, V2 &stdvector, boost::container::cont
|
||||
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
|
||||
}
|
||||
{ //Vector(const Vector &, alloc)
|
||||
::boost::movelib::unique_ptr<V1> const pv1 = ::boost::movelib::make_unique<V1>(boostvector, typename V1::allocator_type());
|
||||
::boost::movelib::unique_ptr<V2> const pv2 = ::boost::movelib::make_unique<V2>(stdvector);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const pv1 =
|
||||
::boost::movelib::make_unique<MyBoostVector>(boostvector, typename MyBoostVector::allocator_type());
|
||||
::boost::movelib::unique_ptr<MyStdVector> const pv2 =
|
||||
::boost::movelib::make_unique<MyStdVector>(stdvector);
|
||||
|
||||
V1 &v1 = *pv1;
|
||||
V2 &v2 = *pv2;
|
||||
MyBoostVector &v1 = *pv1;
|
||||
MyStdVector &v2 = *pv2;
|
||||
|
||||
boostvector.clear();
|
||||
stdvector.clear();
|
||||
@@ -158,7 +162,47 @@ bool vector_copyable_only(V1 &boostvector, V2 &stdvector, boost::container::cont
|
||||
stdvector.assign(v2.begin(), v2.end());
|
||||
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
|
||||
}
|
||||
|
||||
{ //Vector(n, T)
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp =
|
||||
::boost::movelib::make_unique<MyStdVector>(100, int(5));
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp =
|
||||
::boost::movelib::make_unique<MyBoostVector>(100, IntType(5));
|
||||
if(!test::CheckEqualContainers(*boostvectorp, *stdvectorp)) return 1;
|
||||
}
|
||||
{ //Vector(n, T, alloc)
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp =
|
||||
::boost::movelib::make_unique<MyStdVector>(100, int(5));
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp =
|
||||
::boost::movelib::make_unique<MyBoostVector>(100, IntType(5), typename MyBoostVector::allocator_type());
|
||||
if(!test::CheckEqualContainers(*boostvectorp, *stdvectorp)) return 1;
|
||||
}
|
||||
{ //Vector(It, It)
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp =
|
||||
::boost::movelib::make_unique<MyStdVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp =
|
||||
::boost::movelib::make_unique<MyBoostVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp2 =
|
||||
::boost::movelib::make_unique<MyBoostVector>(boostvectorp->begin(), boostvectorp->end());
|
||||
if(!test::CheckEqualContainers(*boostvectorp2, *stdvectorp)) return 1;
|
||||
}
|
||||
{ //Vector(It, It, alloc)
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp =
|
||||
::boost::movelib::make_unique<MyStdVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp =
|
||||
::boost::movelib::make_unique<MyBoostVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp2 =
|
||||
::boost::movelib::make_unique<MyBoostVector>(boostvectorp->begin(), boostvectorp->end(), typename MyBoostVector::allocator_type());
|
||||
if(!test::CheckEqualContainers(*boostvectorp2, *stdvectorp)) return 1;
|
||||
}
|
||||
{ //resize(n, T)
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp =
|
||||
::boost::movelib::make_unique<MyStdVector>();
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp =
|
||||
::boost::movelib::make_unique<MyBoostVector>();
|
||||
stdvectorp->resize(100, int(9));
|
||||
boostvectorp->resize(100, IntType(9));
|
||||
if(!test::CheckEqualContainers(*boostvectorp, *stdvectorp)) return 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -173,32 +217,45 @@ int vector_test()
|
||||
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);
|
||||
::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);
|
||||
::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;
|
||||
}
|
||||
{ //Vector(Vector &&)
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp = ::boost::movelib::make_unique<MyStdVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp = ::boost::movelib::make_unique<MyBoostVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp2 = ::boost::movelib::make_unique<MyBoostVector>(::boost::move(*boostvectorp));
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp =
|
||||
::boost::movelib::make_unique<MyStdVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp =
|
||||
::boost::movelib::make_unique<MyBoostVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp2 =
|
||||
::boost::movelib::make_unique<MyBoostVector>(::boost::move(*boostvectorp));
|
||||
if(!test::CheckEqualContainers(*boostvectorp2, *stdvectorp)) return 1;
|
||||
}
|
||||
{ //Vector(Vector &&, alloc)
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp = ::boost::movelib::make_unique<MyStdVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp = ::boost::movelib::make_unique<MyBoostVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp2 = ::boost::movelib::make_unique<MyBoostVector>
|
||||
(::boost::move(*boostvectorp), typename MyBoostVector::allocator_type());
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp =
|
||||
::boost::movelib::make_unique<MyStdVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp =
|
||||
::boost::movelib::make_unique<MyBoostVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp2 =
|
||||
::boost::movelib::make_unique<MyBoostVector>
|
||||
(::boost::move(*boostvectorp), typename MyBoostVector::allocator_type());
|
||||
if(!test::CheckEqualContainers(*boostvectorp2, *stdvectorp)) return 1;
|
||||
}
|
||||
{ //Vector operator=(Vector &&)
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp = ::boost::movelib::make_unique<MyStdVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp = ::boost::movelib::make_unique<MyBoostVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp2 = ::boost::movelib::make_unique<MyBoostVector>();
|
||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp =
|
||||
::boost::movelib::make_unique<MyStdVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp =
|
||||
::boost::movelib::make_unique<MyBoostVector>(100);
|
||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp2 =
|
||||
::boost::movelib::make_unique<MyBoostVector>();
|
||||
*boostvectorp2 = ::boost::move(*boostvectorp);
|
||||
if(!test::CheckEqualContainers(*boostvectorp2, *stdvectorp)) return 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user