forked from boostorg/container
Typedef'ed allocator_arg_t as "const std::allocator_arg_t &" to improve interoperability between C++11 allocator-aware types.
This commit is contained in:
@@ -117,7 +117,6 @@ struct mark_on_destructor
|
||||
enum ConstructionTypeEnum
|
||||
{
|
||||
ConstructiblePrefix,
|
||||
ConstructibleStdPrefix,
|
||||
ConstructibleSuffix,
|
||||
NotUsesAllocator
|
||||
};
|
||||
@@ -138,8 +137,6 @@ struct uses_allocator_base<ConstructibleSuffix, AllocatorTag>
|
||||
typedef allocator_type allocator_constructor_type;
|
||||
struct nat{};
|
||||
typedef nat allocator_arg_type;
|
||||
struct nat2{};
|
||||
typedef nat2 std_allocator_arg_type;
|
||||
};
|
||||
|
||||
template<unsigned int AllocatorTag>
|
||||
@@ -148,18 +145,6 @@ struct uses_allocator_base<ConstructiblePrefix, AllocatorTag>
|
||||
typedef test_allocator<int, AllocatorTag> allocator_type;
|
||||
typedef allocator_type allocator_constructor_type;
|
||||
typedef allocator_arg_t allocator_arg_type;
|
||||
struct nat{};
|
||||
typedef nat std_allocator_arg_type;
|
||||
};
|
||||
|
||||
template<unsigned int AllocatorTag>
|
||||
struct uses_allocator_base<ConstructibleStdPrefix, AllocatorTag>
|
||||
{
|
||||
typedef test_allocator<int, AllocatorTag> allocator_type;
|
||||
typedef allocator_type allocator_constructor_type;
|
||||
struct nat{};
|
||||
typedef nat allocator_arg_type;
|
||||
typedef const std::allocator_arg_t& std_allocator_arg_type;
|
||||
};
|
||||
|
||||
template<unsigned int AllocatorTag>
|
||||
@@ -168,8 +153,6 @@ struct uses_allocator_base<NotUsesAllocator, AllocatorTag>
|
||||
struct nat{};
|
||||
typedef nat allocator_constructor_type;
|
||||
typedef nat allocator_arg_type;
|
||||
struct nat2{};
|
||||
typedef nat2 std_allocator_arg_type;
|
||||
};
|
||||
|
||||
template<ConstructionTypeEnum ConstructionType, unsigned int AllocatorTag>
|
||||
@@ -198,11 +181,6 @@ struct mark_on_scoped_allocation
|
||||
: construction_type(ConstructiblePrefix), value(0)
|
||||
{}
|
||||
|
||||
explicit mark_on_scoped_allocation
|
||||
(typename base_type::std_allocator_arg_type, typename base_type::allocator_constructor_type)
|
||||
: construction_type(ConstructibleStdPrefix), value(0)
|
||||
{}
|
||||
|
||||
//1 user argument constructors
|
||||
explicit mark_on_scoped_allocation(int i)
|
||||
: construction_type(NotUsesAllocator), value(i)
|
||||
@@ -220,13 +198,6 @@ struct mark_on_scoped_allocation
|
||||
: construction_type(ConstructiblePrefix), value(i)
|
||||
{}
|
||||
|
||||
mark_on_scoped_allocation
|
||||
( typename base_type::std_allocator_arg_type
|
||||
, typename base_type::allocator_constructor_type
|
||||
, int i)
|
||||
: construction_type(ConstructibleStdPrefix), value(i)
|
||||
{}
|
||||
|
||||
//Copy constructors
|
||||
mark_on_scoped_allocation(const mark_on_scoped_allocation &other)
|
||||
: construction_type(NotUsesAllocator), value(other.value)
|
||||
@@ -243,12 +214,6 @@ struct mark_on_scoped_allocation
|
||||
: construction_type(ConstructiblePrefix), value(other.value)
|
||||
{}
|
||||
|
||||
mark_on_scoped_allocation( typename base_type::std_allocator_arg_type
|
||||
, typename base_type::allocator_constructor_type
|
||||
, const mark_on_scoped_allocation &other)
|
||||
: construction_type(ConstructibleStdPrefix), value(other.value)
|
||||
{}
|
||||
|
||||
//Move constructors
|
||||
mark_on_scoped_allocation(BOOST_RV_REF(mark_on_scoped_allocation) other)
|
||||
: construction_type(NotUsesAllocator), value(other.value)
|
||||
@@ -265,12 +230,6 @@ struct mark_on_scoped_allocation
|
||||
: construction_type(ConstructiblePrefix), value(other.value)
|
||||
{ other.value = 0; other.construction_type = ConstructiblePrefix; }
|
||||
|
||||
mark_on_scoped_allocation( typename base_type::std_allocator_arg_type
|
||||
, typename base_type::allocator_constructor_type
|
||||
, BOOST_RV_REF(mark_on_scoped_allocation) other)
|
||||
: construction_type(ConstructibleStdPrefix), value(other.value)
|
||||
{ other.value = 0; other.construction_type = ConstructibleStdPrefix; }
|
||||
|
||||
ConstructionTypeEnum construction_type;
|
||||
int value;
|
||||
};
|
||||
@@ -285,13 +244,6 @@ struct constructible_with_allocator_prefix
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template<unsigned int AllocatorTag>
|
||||
struct constructible_with_std_allocator_prefix
|
||||
< ::mark_on_scoped_allocation<ConstructibleStdPrefix, AllocatorTag> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template<unsigned int AllocatorTag>
|
||||
struct constructible_with_allocator_suffix
|
||||
< ::mark_on_scoped_allocation<ConstructibleSuffix, AllocatorTag> >
|
||||
@@ -819,18 +771,12 @@ int main()
|
||||
< ::mark_on_scoped_allocation<ConstructiblePrefix, 0>
|
||||
, test_allocator<float, 0>
|
||||
>::value ));
|
||||
BOOST_STATIC_ASSERT(( boost::container::uses_allocator
|
||||
< ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0>
|
||||
, test_allocator<float, 0>
|
||||
>::value ));
|
||||
BOOST_STATIC_ASSERT(( boost::container::uses_allocator
|
||||
< ::mark_on_scoped_allocation<ConstructibleSuffix, 0>
|
||||
, test_allocator<float, 0>
|
||||
>::value ));
|
||||
BOOST_STATIC_ASSERT(( boost::container::constructible_with_allocator_prefix
|
||||
< ::mark_on_scoped_allocation<ConstructiblePrefix, 0> >::value ));
|
||||
BOOST_STATIC_ASSERT(( boost::container::constructible_with_std_allocator_prefix
|
||||
< ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> >::value ));
|
||||
BOOST_STATIC_ASSERT(( boost::container::constructible_with_allocator_suffix
|
||||
< ::mark_on_scoped_allocation<ConstructibleSuffix, 0> >::value ));
|
||||
|
||||
@@ -878,18 +824,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||
MarkType dummy;
|
||||
dummy.~MarkType();
|
||||
s0i.construct(&dummy);
|
||||
if(dummy.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.value != 0){
|
||||
dummy.~MarkType();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
|
||||
//Check construction with 1 user arguments
|
||||
{
|
||||
@@ -928,18 +862,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||
MarkType dummy;
|
||||
dummy.~MarkType();
|
||||
s0i.construct(&dummy, 3);
|
||||
if(dummy.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.value != 3){
|
||||
dummy.~MarkType();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////
|
||||
//Then check scoped allocator with OuterAlloc and InnerAlloc.
|
||||
@@ -985,18 +907,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 1> MarkType;
|
||||
MarkType dummy;
|
||||
dummy.~MarkType();
|
||||
s1i.construct(&dummy);
|
||||
if(dummy.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.value != 0){
|
||||
dummy.~MarkType();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
|
||||
//Check construction with 1 user arguments
|
||||
{
|
||||
@@ -1035,18 +945,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 1> MarkType;
|
||||
MarkType dummy;
|
||||
dummy.~MarkType();
|
||||
s1i.construct(&dummy, 3);
|
||||
if(dummy.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.value != 3){
|
||||
dummy.~MarkType();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1114,18 +1012,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 10> MarkType;
|
||||
MarkType dummy;
|
||||
dummy.~MarkType();
|
||||
ssro0i.construct(&dummy);
|
||||
if(dummy.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.value != 0){
|
||||
dummy.~MarkType();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
|
||||
//Check construction with 1 user arguments
|
||||
{
|
||||
@@ -1164,18 +1050,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 10> MarkType;
|
||||
MarkType dummy;
|
||||
dummy.~MarkType();
|
||||
ssro0i.construct(&dummy, 3);
|
||||
if(dummy.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.value != 3){
|
||||
dummy.~MarkType();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////
|
||||
//Then check scoped allocator with OuterAlloc and InnerAlloc.
|
||||
@@ -1245,18 +1119,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 10> MarkType;
|
||||
MarkType dummy;
|
||||
dummy.~MarkType();
|
||||
ssro1i.construct(&dummy);
|
||||
if(dummy.construction_type != NotUsesAllocator ||
|
||||
dummy.value != 0){
|
||||
dummy.~MarkType();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
|
||||
//Check construction with 1 user arguments
|
||||
{
|
||||
@@ -1295,18 +1157,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 10> MarkType;
|
||||
MarkType dummy;
|
||||
dummy.~MarkType();
|
||||
ssro1i.construct(&dummy, 3);
|
||||
if(dummy.construction_type != NotUsesAllocator ||
|
||||
dummy.value != 3){
|
||||
dummy.~MarkType();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkType();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -1370,21 +1220,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkTypePair();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||
typedef pair<MarkType, MarkType> MarkTypePair;
|
||||
MarkTypePair dummy;
|
||||
dummy.~MarkTypePair();
|
||||
s0i.construct(&dummy);
|
||||
if(dummy.first.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.second.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.first.value != 0 ||
|
||||
dummy.second.value != 0 ){
|
||||
dummy.~MarkTypePair();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkTypePair();
|
||||
}
|
||||
|
||||
//Check construction with 1 user arguments for each pair
|
||||
{
|
||||
@@ -1432,21 +1267,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkTypePair();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||
typedef pair<MarkType, MarkType> MarkTypePair;
|
||||
MarkTypePair dummy;
|
||||
dummy.~MarkTypePair();
|
||||
s0i.construct(&dummy, 2, 2);
|
||||
if(dummy.first.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.second.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.first.value != 2 ||
|
||||
dummy.second.value != 2 ){
|
||||
dummy.~MarkTypePair();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkTypePair();
|
||||
}
|
||||
//Check construction with pair copy construction
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
|
||||
@@ -1493,21 +1313,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkTypePair();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||
typedef pair<MarkType, MarkType> MarkTypePair;
|
||||
MarkTypePair dummy, dummy2(2, 2);
|
||||
dummy.~MarkTypePair();
|
||||
s0i.construct(&dummy, dummy2);
|
||||
if(dummy.first.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.second.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.first.value != 2 ||
|
||||
dummy.second.value != 2 ){
|
||||
dummy.~MarkTypePair();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkTypePair();
|
||||
}
|
||||
//Check construction with pair move construction
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
|
||||
@@ -1567,25 +1372,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkTypePair();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||
typedef pair<MarkType, MarkType> MarkTypePair;
|
||||
MarkTypePair dummy, dummy2(2, 2);
|
||||
dummy.~MarkTypePair();
|
||||
s0i.construct(&dummy, ::boost::move(dummy2));
|
||||
if(dummy.first.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.second.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.first.value != 2 ||
|
||||
dummy.second.value != 2 ||
|
||||
dummy2.first.construction_type != ConstructibleStdPrefix ||
|
||||
dummy2.second.construction_type != ConstructibleStdPrefix ||
|
||||
dummy2.first.value != 0 ||
|
||||
dummy2.second.value != 0 ){
|
||||
dummy2.~MarkTypePair();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkTypePair();
|
||||
}
|
||||
//Check construction with related pair copy construction
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
|
||||
@@ -1635,22 +1421,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkTypePair();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||
typedef pair<MarkType, MarkType> MarkTypePair;
|
||||
MarkTypePair dummy;
|
||||
pair<int, int> dummy2(2, 2);
|
||||
dummy.~MarkTypePair();
|
||||
s0i.construct(&dummy, dummy2);
|
||||
if(dummy.first.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.second.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.first.value != 2 ||
|
||||
dummy.second.value != 2 ){
|
||||
dummy.~MarkTypePair();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkTypePair();
|
||||
}
|
||||
//Check construction with related pair move construction
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
|
||||
@@ -1700,22 +1470,6 @@ int main()
|
||||
}
|
||||
dummy.~MarkTypePair();
|
||||
}
|
||||
{
|
||||
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||
typedef pair<MarkType, MarkType> MarkTypePair;
|
||||
MarkTypePair dummy;
|
||||
pair<int, int> dummy2(2, 2);
|
||||
dummy.~MarkTypePair();
|
||||
s0i.construct(&dummy, ::boost::move(dummy2));
|
||||
if(dummy.first.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.second.construction_type != ConstructibleStdPrefix ||
|
||||
dummy.first.value != 2 ||
|
||||
dummy.second.value != 2 ){
|
||||
dummy.~MarkTypePair();
|
||||
return 1;
|
||||
}
|
||||
dummy.~MarkTypePair();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user