forked from boostorg/container
Don't use allocator::rebind as it is not present on recent c++ standards
This commit is contained in:
1 parent
a5cc4f1eef
commit
c0bfb40f55
3 files changed
+64
-61
No files matched your search
@@ -31,21 +31,6 @@ using boost::move_detail::nanosecond_type;
|
||||
|
||||
namespace bc = boost::container;
|
||||
|
||||
typedef std::allocator<int> StdAllocator;
|
||||
typedef bc::allocator<int, 2> AllocatorPlusV2;
|
||||
typedef bc::allocator<int, 1> AllocatorPlusV1;
|
||||
|
||||
template<class Allocator> struct get_allocator_name;
|
||||
|
||||
template<> struct get_allocator_name<StdAllocator>
|
||||
{ static const char *get() { return "StdAllocator"; } };
|
||||
|
||||
template<> struct get_allocator_name<AllocatorPlusV2>
|
||||
{ static const char *get() { return "AllocatorPlusV2"; } };
|
||||
|
||||
template<> struct get_allocator_name<AllocatorPlusV1>
|
||||
{ static const char *get() { return "AllocatorPlusV1"; } };
|
||||
|
||||
class MyInt
|
||||
{
|
||||
std::size_t int_; //Use a type that will grow on 64 bit machines
|
||||
@@ -64,6 +49,21 @@ class MyInt
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::allocator<MyInt> StdAllocator;
|
||||
typedef bc::allocator<MyInt, 2> AllocatorPlusV2;
|
||||
typedef bc::allocator<MyInt, 1> AllocatorPlusV1;
|
||||
|
||||
template<class Allocator> struct get_allocator_name;
|
||||
|
||||
template<> struct get_allocator_name<StdAllocator>
|
||||
{ static const char *get() { return "StdAllocator"; } };
|
||||
|
||||
template<> struct get_allocator_name<AllocatorPlusV2>
|
||||
{ static const char *get() { return "AllocatorPlusV2"; } };
|
||||
|
||||
template<> struct get_allocator_name<AllocatorPlusV1>
|
||||
{ static const char *get() { return "AllocatorPlusV1"; } };
|
||||
|
||||
void print_header()
|
||||
{
|
||||
std::cout << "Allocator" << ";" << "Iterations" << ";" << "Size" << ";"
|
||||
@@ -73,7 +73,7 @@ void print_header()
|
||||
template<class Allocator>
|
||||
void vector_test_template(unsigned int num_iterations, unsigned int num_elements, bool csv_output)
|
||||
{
|
||||
typedef typename Allocator::template rebind<MyInt>::other IntAllocator;
|
||||
typedef Allocator IntAllocator;
|
||||
|
||||
unsigned int capacity = 0;
|
||||
const std::size_t Step = 5;
|
||||
|
||||
Reference in new issue
Block a user