forked from boostorg/container
Don't use allocator::rebind as it is not present on recent c++ standards
This commit is contained in:
@@ -23,31 +23,11 @@
|
||||
#include <cassert> //assert
|
||||
|
||||
#include <boost/move/detail/nsec_clock.hpp>
|
||||
|
||||
using boost::move_detail::cpu_timer;
|
||||
using boost::move_detail::cpu_times;
|
||||
using boost::move_detail::nanosecond_type;
|
||||
|
||||
namespace bc = boost::container;
|
||||
|
||||
typedef std::allocator<int> StdAllocator;
|
||||
typedef bc::allocator<int, 2, bc::expand_bwd | bc::expand_fwd> AllocatorPlusV2Mask;
|
||||
typedef bc::allocator<int, 2, bc::expand_fwd> 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<AllocatorPlusV2Mask>
|
||||
{ static const char *get() { return "AllocatorPlusV2Mask"; } };
|
||||
|
||||
template<> struct get_allocator_name<AllocatorPlusV2>
|
||||
{ static const char *get() { return "AllocatorPlusV2"; } };
|
||||
|
||||
template<> struct get_allocator_name<AllocatorPlusV1>
|
||||
{ static const char *get() { return "AllocatorPlusV1"; } };
|
||||
|
||||
//typedef int MyInt;
|
||||
|
||||
class MyInt
|
||||
@@ -89,6 +69,30 @@ struct has_trivial_destructor_after_move<MyInt>
|
||||
} //namespace boost{
|
||||
|
||||
|
||||
namespace bc = boost::container;
|
||||
|
||||
typedef std::allocator<MyInt> StdAllocator;
|
||||
typedef bc::allocator<MyInt, 2, bc::expand_bwd | bc::expand_fwd> AllocatorPlusV2Mask;
|
||||
typedef bc::allocator<MyInt, 2, bc::expand_fwd> 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<AllocatorPlusV2Mask>
|
||||
{ static const char *get() { return "AllocatorPlusV2Mask"; } };
|
||||
|
||||
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" << ";"
|
||||
@@ -99,7 +103,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 numalloc = 0, numexpand = 0;
|
||||
|
||||
cpu_timer timer;
|
||||
|
||||
Reference in New Issue
Block a user