forked from boostorg/container
Don't use allocator::rebind as it is not present on recent c++ standards
This commit is contained in:
@@ -34,11 +34,27 @@ using boost::move_detail::nanosecond_type;
|
||||
|
||||
namespace bc = boost::container;
|
||||
|
||||
typedef std::allocator<int> StdAllocator;
|
||||
typedef bc::allocator<int, 1> AllocatorPlusV1;
|
||||
typedef bc::allocator<int, 2> AllocatorPlusV2;
|
||||
class MyInt
|
||||
{
|
||||
int int_;
|
||||
|
||||
public:
|
||||
MyInt(int i = 0) : int_(i){}
|
||||
MyInt(const MyInt &other)
|
||||
: int_(other.int_)
|
||||
{}
|
||||
MyInt & operator=(const MyInt &other)
|
||||
{
|
||||
int_ = other.int_;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::allocator<MyInt> StdAllocator;
|
||||
typedef bc::allocator<MyInt, 1> AllocatorPlusV1;
|
||||
typedef bc::allocator<MyInt, 2> AllocatorPlusV2;
|
||||
typedef bc::adaptive_pool
|
||||
< int
|
||||
< MyInt
|
||||
, bc::ADP_nodes_per_block
|
||||
, 0//bc::ADP_max_free_blocks
|
||||
, 2
|
||||
@@ -58,27 +74,10 @@ template<> struct get_allocator_name<AllocatorPlusV2>
|
||||
template<> struct get_allocator_name<AdPool2PercentV2>
|
||||
{ static const char *get() { return "AdPool2PercentV2"; } };
|
||||
|
||||
class MyInt
|
||||
{
|
||||
int int_;
|
||||
|
||||
public:
|
||||
MyInt(int i = 0) : int_(i){}
|
||||
MyInt(const MyInt &other)
|
||||
: int_(other.int_)
|
||||
{}
|
||||
MyInt & operator=(const MyInt &other)
|
||||
{
|
||||
int_ = other.int_;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
template<class Allocator>
|
||||
struct get_vector
|
||||
{
|
||||
typedef bc::vector
|
||||
<MyInt, typename Allocator::template rebind<MyInt>::other> type;
|
||||
typedef bc::vector<MyInt, Allocator> type;
|
||||
static const char *vector_name()
|
||||
{
|
||||
return "vector<MyInt>";
|
||||
@@ -89,7 +88,7 @@ template<class Allocator>
|
||||
struct get_stable_vector
|
||||
{
|
||||
typedef bc::stable_vector
|
||||
<MyInt, typename Allocator::template rebind<MyInt>::other> type;
|
||||
<MyInt, Allocator> type;
|
||||
static const char *vector_name()
|
||||
{
|
||||
return "stable_vector<MyInt>";
|
||||
|
||||
Reference in New Issue
Block a user