mirror of
https://github.com/boostorg/container.git
synced 2025-08-01 05:24:31 +02:00
Support Clang's -Wconversion -Wfloat-conversion -Wsign-conversion with -Werror
This commit is contained in:
@@ -30,10 +30,10 @@ using boost::move_detail::nanosecond_type;
|
|||||||
using namespace boost::container;
|
using namespace boost::container;
|
||||||
|
|
||||||
template <class POD>
|
template <class POD>
|
||||||
void allocation_timing_test(unsigned int num_iterations, unsigned int num_elements)
|
void allocation_timing_test(std::size_t num_iterations, std::size_t num_elements)
|
||||||
{
|
{
|
||||||
size_t capacity = 0;
|
size_t capacity = 0;
|
||||||
unsigned int numalloc = 0, numexpand = 0;
|
std::size_t numalloc = 0, numexpand = 0;
|
||||||
|
|
||||||
std::cout
|
std::cout
|
||||||
<< " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n"
|
<< " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n"
|
||||||
@@ -52,7 +52,7 @@ void allocation_timing_test(unsigned int num_iterations, unsigned int num_elemen
|
|||||||
cpu_timer timer;
|
cpu_timer timer;
|
||||||
timer.resume();
|
timer.resume();
|
||||||
|
|
||||||
for(unsigned int r = 0; r != num_iterations; ++r){
|
for(std::size_t r = 0; r != num_iterations; ++r){
|
||||||
void *first_mem = 0;
|
void *first_mem = 0;
|
||||||
if(m_mode != BOOST_CONTAINER_EXPAND_FWD)
|
if(m_mode != BOOST_CONTAINER_EXPAND_FWD)
|
||||||
first_mem = dlmalloc_malloc(sizeof(POD)*num_elements*3/2);
|
first_mem = dlmalloc_malloc(sizeof(POD)*num_elements*3/2);
|
||||||
@@ -123,7 +123,7 @@ void allocation_timing_test(unsigned int num_iterations, unsigned int num_elemen
|
|||||||
<< float(nseconds)/float(num_iterations*num_elements)
|
<< float(nseconds)/float(num_iterations*num_elements)
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " capacity - alloc calls (new/expand): "
|
<< " capacity - alloc calls (new/expand): "
|
||||||
<< (unsigned int)capacity << " - "
|
<< (std::size_t)capacity << " - "
|
||||||
<< (float(numalloc) + float(numexpand))/float(num_iterations)
|
<< (float(numalloc) + float(numexpand))/float(num_iterations)
|
||||||
<< "(" << float(numalloc)/float(num_iterations) << "/" << float(numexpand)/float(num_iterations) << ")"
|
<< "(" << float(numalloc)/float(num_iterations) << "/" << float(numexpand)/float(num_iterations) << ")"
|
||||||
<< std::endl << std::endl;
|
<< std::endl << std::endl;
|
||||||
@@ -152,24 +152,24 @@ int allocation_loop()
|
|||||||
#define SIMPLE_IT
|
#define SIMPLE_IT
|
||||||
#ifdef SINGLE_TEST
|
#ifdef SINGLE_TEST
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
unsigned int numrep [] = { 50000 };
|
std::size_t numrep [] = { 50000 };
|
||||||
#else
|
#else
|
||||||
unsigned int numrep [] = { 5000 };
|
std::size_t numrep [] = { 5000 };
|
||||||
#endif
|
#endif
|
||||||
unsigned int numele [] = { 100 };
|
std::size_t numele [] = { 100 };
|
||||||
#elif defined(SIMPLE_IT)
|
#elif defined(SIMPLE_IT)
|
||||||
unsigned int numrep [] = { 3 };
|
std::size_t numrep [] = { 3 };
|
||||||
unsigned int numele [] = { 100 };
|
std::size_t numele [] = { 100 };
|
||||||
#else
|
#else
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
unsigned int numrep [] = { /*10000, */10000, 100000, 1000000 };
|
std::size_t numrep [] = { /*10000, */10000, 100000, 1000000 };
|
||||||
#else
|
#else
|
||||||
unsigned int numrep [] = { /*10000, */1000, 10000, 100000 };
|
std::size_t numrep [] = { /*10000, */1000, 10000, 100000 };
|
||||||
#endif
|
#endif
|
||||||
unsigned int numele [] = { /*10000, */1000, 100, 10 };
|
std::size_t numele [] = { /*10000, */1000, 100, 10 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
allocation_timing_test<POD>(numrep[i], numele[i]);
|
allocation_timing_test<POD>(numrep[i], numele[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -101,16 +101,16 @@ void print_header()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class Allocator>
|
template<class Allocator>
|
||||||
void vector_test_template(unsigned int num_iterations, unsigned int num_elements, bool csv_output)
|
void vector_test_template(std::size_t num_iterations, std::size_t num_elements, bool csv_output)
|
||||||
{
|
{
|
||||||
typedef Allocator IntAllocator;
|
typedef Allocator IntAllocator;
|
||||||
unsigned int numalloc = 0, numexpand = 0;
|
std::size_t numalloc = 0, numexpand = 0;
|
||||||
|
|
||||||
cpu_timer timer;
|
cpu_timer timer;
|
||||||
timer.resume();
|
timer.resume();
|
||||||
|
|
||||||
unsigned int capacity = 0;
|
std::size_t capacity = 0;
|
||||||
for(unsigned int r = 0; r != num_iterations; ++r){
|
for(std::size_t r = 0; r != num_iterations; ++r){
|
||||||
bc::vector<MyInt, IntAllocator> v;
|
bc::vector<MyInt, IntAllocator> v;
|
||||||
v.reset_alloc_stats();
|
v.reset_alloc_stats();
|
||||||
void *first_mem = 0;
|
void *first_mem = 0;
|
||||||
@@ -119,12 +119,12 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
|
|||||||
v.push_back(MyInt(0));
|
v.push_back(MyInt(0));
|
||||||
bc::dlmalloc_free(first_mem);
|
bc::dlmalloc_free(first_mem);
|
||||||
|
|
||||||
for(unsigned int e = 0; e != num_elements; ++e){
|
for(std::size_t e = 0; e != num_elements; ++e){
|
||||||
v.push_back(MyInt(e));
|
v.push_back(MyInt((int)e));
|
||||||
}
|
}
|
||||||
numalloc += v.num_alloc;
|
numalloc += v.num_alloc;
|
||||||
numexpand += v.num_expand_bwd;
|
numexpand += v.num_expand_bwd;
|
||||||
capacity = static_cast<unsigned int>(v.capacity());
|
capacity = static_cast<std::size_t>(v.capacity());
|
||||||
}
|
}
|
||||||
BOOST_CATCH(...){
|
BOOST_CATCH(...){
|
||||||
bc::dlmalloc_free(first_mem);
|
bc::dlmalloc_free(first_mem);
|
||||||
@@ -164,7 +164,7 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
|
|||||||
<< float(nseconds)/float(num_iterations*num_elements)
|
<< float(nseconds)/float(num_iterations*num_elements)
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " capacity - alloc calls (new/expand): "
|
<< " capacity - alloc calls (new/expand): "
|
||||||
<< (unsigned int)capacity << " - "
|
<< (std::size_t)capacity << " - "
|
||||||
<< (float(numalloc) + float(numexpand))/float(num_iterations)
|
<< (float(numalloc) + float(numexpand))/float(num_iterations)
|
||||||
<< "(" << float(numalloc)/float(num_iterations) << "/" << float(numexpand)/float(num_iterations) << ")"
|
<< "(" << float(numalloc)/float(num_iterations) << "/" << float(numexpand)/float(num_iterations) << ")"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@@ -181,42 +181,42 @@ int main(int argc, const char *argv[])
|
|||||||
#define SIMPLE_IT
|
#define SIMPLE_IT
|
||||||
#ifdef SINGLE_TEST
|
#ifdef SINGLE_TEST
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
unsigned int numit [] = { 10 };
|
std::size_t numit [] = { 10 };
|
||||||
#else
|
#else
|
||||||
unsigned int numit [] = { 10 };
|
std::size_t numit [] = { 10 };
|
||||||
#endif
|
#endif
|
||||||
unsigned int numele [] = { 10000 };
|
std::size_t numele [] = { 10000 };
|
||||||
#elif defined(SIMPLE_IT)
|
#elif defined(SIMPLE_IT)
|
||||||
unsigned int numit [] = { 3 };
|
std::size_t numit [] = { 3 };
|
||||||
unsigned int numele[] = { 10000 };
|
std::size_t numele[] = { 10000 };
|
||||||
#else
|
#else
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
unsigned int numit [] = { 2000, 20000, 200000, 2000000 };
|
std::size_t numit [] = { 2000, 20000, 200000, 2000000 };
|
||||||
#else
|
#else
|
||||||
unsigned int numit [] = { 100, 1000, 10000, 100000 };
|
std::size_t numit [] = { 100, 1000, 10000, 100000 };
|
||||||
#endif
|
#endif
|
||||||
unsigned int numele [] = { 10000, 1000, 100, 10 };
|
std::size_t numele [] = { 10000, 1000, 100, 10 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool csv_output = argc == 2 && (strcmp(argv[1], "--csv-output") == 0);
|
bool csv_output = argc == 2 && (strcmp(argv[1], "--csv-output") == 0);
|
||||||
|
|
||||||
if(csv_output){
|
if(csv_output){
|
||||||
print_header();
|
print_header();
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
vector_test_template<StdAllocator>(numit[i], numele[i], csv_output);
|
vector_test_template<StdAllocator>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
vector_test_template<AllocatorPlusV1>(numit[i], numele[i], csv_output);
|
vector_test_template<AllocatorPlusV1>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
vector_test_template<AllocatorPlusV2Mask>(numit[i], numele[i], csv_output);
|
vector_test_template<AllocatorPlusV2Mask>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
vector_test_template<AllocatorPlusV2>(numit[i], numele[i], csv_output);
|
vector_test_template<AllocatorPlusV2>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
std::cout << "\n ----------------------------------- \n"
|
std::cout << "\n ----------------------------------- \n"
|
||||||
<< " Iterations/Elements: " << numit[i] << "/" << numele[i]
|
<< " Iterations/Elements: " << numit[i] << "/" << numele[i]
|
||||||
<< "\n ----------------------------------- \n";
|
<< "\n ----------------------------------- \n";
|
||||||
|
@@ -85,15 +85,15 @@ class MyInt
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
void vector_test_template(unsigned int num_iterations, unsigned int num_elements)
|
void vector_test_template(std::size_t num_iterations, std::size_t num_elements)
|
||||||
{
|
{
|
||||||
unsigned int numalloc = 0, numexpand = 0;
|
std::size_t numalloc = 0, numexpand = 0;
|
||||||
|
|
||||||
cpu_timer timer;
|
cpu_timer timer;
|
||||||
timer.resume();
|
timer.resume();
|
||||||
|
|
||||||
unsigned int capacity = 0;
|
std::size_t capacity = 0;
|
||||||
for(unsigned int r = 0; r != num_iterations; ++r){
|
for(std::size_t r = 0; r != num_iterations; ++r){
|
||||||
Container v;
|
Container v;
|
||||||
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
|
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
|
||||||
reset_alloc_stats(v);
|
reset_alloc_stats(v);
|
||||||
@@ -101,47 +101,47 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
|
|||||||
//v.reserve(num_elements);
|
//v.reserve(num_elements);
|
||||||
//MyInt a[3];
|
//MyInt a[3];
|
||||||
/*
|
/*
|
||||||
for(unsigned int e = 0; e != num_elements/3; ++e){
|
for(std::size_t e = 0; e != num_elements/3; ++e){
|
||||||
v.insert(v.end(), &a[0], &a[0]+3);
|
v.insert(v.end(), &a[0], &a[0]+3);
|
||||||
}*/
|
}*/
|
||||||
/*
|
/*
|
||||||
for(unsigned int e = 0; e != num_elements/3; ++e){
|
for(std::size_t e = 0; e != num_elements/3; ++e){
|
||||||
v.insert(v.end(), 3, MyInt(e));
|
v.insert(v.end(), 3, MyInt((int)e));
|
||||||
}*/
|
}*/
|
||||||
/*
|
/*
|
||||||
for(unsigned int e = 0; e != num_elements/3; ++e){
|
for(std::size_t e = 0; e != num_elements/3; ++e){
|
||||||
v.insert(v.empty() ? v.end() : --v.end(), &a[0], &a[0]+3);
|
v.insert(v.empty() ? v.end() : --v.end(), &a[0], &a[0]+3);
|
||||||
}*/
|
}*/
|
||||||
/*
|
/*
|
||||||
for(unsigned int e = 0; e != num_elements/3; ++e){
|
for(std::size_t e = 0; e != num_elements/3; ++e){
|
||||||
v.insert(v.empty() ? v.end() : --v.end(), 3, MyInt(e));
|
v.insert(v.empty() ? v.end() : --v.end(), 3, MyInt((int)e));
|
||||||
}*/
|
}*/
|
||||||
/*
|
/*
|
||||||
for(unsigned int e = 0; e != num_elements/3; ++e){
|
for(std::size_t e = 0; e != num_elements/3; ++e){
|
||||||
v.insert(v.size() >= 3 ? v.end()-3 : v.begin(), &a[0], &a[0]+3);
|
v.insert(v.size() >= 3 ? v.end()-3 : v.begin(), &a[0], &a[0]+3);
|
||||||
}*/
|
}*/
|
||||||
/*
|
/*
|
||||||
for(unsigned int e = 0; e != num_elements/3; ++e){
|
for(std::size_t e = 0; e != num_elements/3; ++e){
|
||||||
v.insert(v.size() >= 3 ? v.end()-3 : v.begin(), 3, MyInt(e));
|
v.insert(v.size() >= 3 ? v.end()-3 : v.begin(), 3, MyInt((int)e));
|
||||||
}*/
|
}*/
|
||||||
/*
|
/*
|
||||||
for(unsigned int e = 0; e != num_elements; ++e){
|
for(std::size_t e = 0; e != num_elements; ++e){
|
||||||
v.insert(v.end(), MyInt(e));
|
v.insert(v.end(), MyInt((int)e));
|
||||||
}*/
|
}*/
|
||||||
/*
|
/*
|
||||||
for(unsigned int e = 0; e != num_elements; ++e){
|
for(std::size_t e = 0; e != num_elements; ++e){
|
||||||
v.insert(v.empty() ? v.end() : --v.end(), MyInt(e));
|
v.insert(v.empty() ? v.end() : --v.end(), MyInt((int)e));
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
for(unsigned int e = 0; e != num_elements; ++e){
|
for(std::size_t e = 0; e != num_elements; ++e){
|
||||||
v.push_back(MyInt(e));
|
v.push_back(MyInt((int)e));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
|
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
|
||||||
numalloc += get_num_alloc(v);
|
numalloc += get_num_alloc(v);
|
||||||
numexpand += get_num_expand(v);
|
numexpand += get_num_expand(v);
|
||||||
#endif
|
#endif
|
||||||
capacity = static_cast<unsigned int>(v.capacity());
|
capacity = static_cast<std::size_t>(v.capacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
timer.stop();
|
timer.stop();
|
||||||
@@ -154,7 +154,7 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
|
|||||||
<< float(nseconds)/float(num_iterations*num_elements)
|
<< float(nseconds)/float(num_iterations*num_elements)
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " capacity - alloc calls (new/expand): "
|
<< " capacity - alloc calls (new/expand): "
|
||||||
<< (unsigned int)capacity << " - "
|
<< (std::size_t)capacity << " - "
|
||||||
<< (float(numalloc) + float(numexpand))/float(num_iterations)
|
<< (float(numalloc) + float(numexpand))/float(num_iterations)
|
||||||
<< "(" << float(numalloc)/float(num_iterations) << "/" << float(numexpand)/float(num_iterations) << ")"
|
<< "(" << float(numalloc)/float(num_iterations) << "/" << float(numexpand)/float(num_iterations) << ")"
|
||||||
<< std::endl << std::endl;
|
<< std::endl << std::endl;
|
||||||
@@ -184,15 +184,15 @@ int main()
|
|||||||
std::size_t numele [] = { 10000 };
|
std::size_t numele [] = { 10000 };
|
||||||
#else
|
#else
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
unsigned int numit [] = { 1000, 10000, 100000, 1000000 };
|
std::size_t numit [] = { 1000, 10000, 100000, 1000000 };
|
||||||
#else
|
#else
|
||||||
unsigned int numit [] = { 100, 1000, 10000, 100000 };
|
std::size_t numit [] = { 100, 1000, 10000, 100000 };
|
||||||
#endif
|
#endif
|
||||||
unsigned int numele [] = { 10000, 1000, 100, 10 };
|
std::size_t numele [] = { 10000, 1000, 100, 10 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
print_header();
|
print_header();
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
vector_test_template< bc::vector<MyInt, std::allocator<MyInt> > >(numit[i], numele[i]);
|
vector_test_template< bc::vector<MyInt, std::allocator<MyInt> > >(numit[i], numele[i]);
|
||||||
vector_test_template< bc::vector<MyInt, bc::allocator<MyInt, 1> > >(numit[i], numele[i]);
|
vector_test_template< bc::vector<MyInt, bc::allocator<MyInt, 1> > >(numit[i], numele[i]);
|
||||||
vector_test_template<bc::vector<MyInt, bc::allocator<MyInt, 2, bc::expand_bwd | bc::expand_fwd> > >(numit[i], numele[i]);
|
vector_test_template<bc::vector<MyInt, bc::allocator<MyInt, 2, bc::expand_bwd | bc::expand_fwd> > >(numit[i], numele[i]);
|
||||||
|
@@ -33,7 +33,7 @@ namespace bc = boost::container;
|
|||||||
|
|
||||||
class MyInt
|
class MyInt
|
||||||
{
|
{
|
||||||
std::size_t int_; //Use a type that will grow on 64 bit machines
|
std::ptrdiff_t int_; //Use a type that will grow on 64 bit machines
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MyInt(int i = 0) : int_(i){}
|
MyInt(int i = 0) : int_(i){}
|
||||||
@@ -71,13 +71,13 @@ void print_header()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class Allocator>
|
template<class Allocator>
|
||||||
void vector_test_template(unsigned int num_iterations, unsigned int num_elements, bool csv_output)
|
void vector_test_template(std::size_t num_iterations, std::size_t num_elements, bool csv_output)
|
||||||
{
|
{
|
||||||
typedef Allocator IntAllocator;
|
typedef Allocator IntAllocator;
|
||||||
|
|
||||||
unsigned int capacity = 0;
|
std::size_t capacity = 0;
|
||||||
const std::size_t Step = 5;
|
const std::size_t Step = 5;
|
||||||
unsigned int num_shrink = 0;
|
std::size_t num_shrink = 0;
|
||||||
(void)capacity;
|
(void)capacity;
|
||||||
|
|
||||||
cpu_timer timer;
|
cpu_timer timer;
|
||||||
@@ -88,12 +88,12 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
|
|||||||
<unsigned, bc::dtl::version<Allocator>::value> alloc_version;
|
<unsigned, bc::dtl::version<Allocator>::value> alloc_version;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned int r = 0; r != num_iterations; ++r){
|
for(std::size_t r = 0; r != num_iterations; ++r){
|
||||||
bc::vector<MyInt, IntAllocator> v(num_elements);
|
bc::vector<MyInt, IntAllocator> v(num_elements);
|
||||||
v.reset_alloc_stats();
|
v.reset_alloc_stats();
|
||||||
num_shrink = 0;
|
num_shrink = 0;
|
||||||
for(unsigned int e = num_elements; e != 0; e -= Step){
|
for(std::size_t e = num_elements; e != 0; e -= Step){
|
||||||
v.erase(v.end() - Step, v.end());
|
v.erase(v.end() - std::ptrdiff_t(Step), v.end());
|
||||||
v.shrink_to_fit();
|
v.shrink_to_fit();
|
||||||
assert( (alloc_version::value != 2) || (e == Step) || (v.num_shrink > num_shrink) );
|
assert( (alloc_version::value != 2) || (e == Step) || (v.num_shrink > num_shrink) );
|
||||||
num_shrink = v.num_shrink;
|
num_shrink = v.num_shrink;
|
||||||
@@ -136,39 +136,39 @@ int main(int argc, const char *argv[])
|
|||||||
#define SIMPLE_IT
|
#define SIMPLE_IT
|
||||||
#ifdef SINGLE_TEST
|
#ifdef SINGLE_TEST
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
unsigned int numit [] = { 10 };
|
std::size_t numit [] = { 10 };
|
||||||
#else
|
#else
|
||||||
unsigned int numit [] = { 50 };
|
std::size_t numit [] = { 50 };
|
||||||
unsigned int numele[] = { 2000 };
|
std::size_t numele[] = { 2000 };
|
||||||
#endif
|
#endif
|
||||||
#elif defined SIMPLE_IT
|
#elif defined SIMPLE_IT
|
||||||
unsigned int numit [] = { 3 };
|
std::size_t numit [] = { 3 };
|
||||||
unsigned int numele[] = { 2000 };
|
std::size_t numele[] = { 2000 };
|
||||||
#else
|
#else
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
unsigned int numit [] = { 100, 1000, 10000 };
|
std::size_t numit [] = { 100, 1000, 10000 };
|
||||||
#else
|
#else
|
||||||
unsigned int numit [] = { 10, 100, 1000 };
|
std::size_t numit [] = { 10, 100, 1000 };
|
||||||
#endif
|
#endif
|
||||||
unsigned int numele [] = { 10000, 2000, 500 };
|
std::size_t numele [] = { 10000, 2000, 500 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool csv_output = argc == 2 && (strcmp(argv[1], "--csv-output") == 0);
|
bool csv_output = argc == 2 && (strcmp(argv[1], "--csv-output") == 0);
|
||||||
|
|
||||||
if(csv_output){
|
if(csv_output){
|
||||||
print_header();
|
print_header();
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
vector_test_template<StdAllocator>(numit[i], numele[i], csv_output);
|
vector_test_template<StdAllocator>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
vector_test_template<AllocatorPlusV1>(numit[i], numele[i], csv_output);
|
vector_test_template<AllocatorPlusV1>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
vector_test_template<AllocatorPlusV2>(numit[i], numele[i], csv_output);
|
vector_test_template<AllocatorPlusV2>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
std::cout << "\n ----------------------------------- \n"
|
std::cout << "\n ----------------------------------- \n"
|
||||||
<< " Iterations/Elements: " << numit[i] << "/" << numele[i]
|
<< " Iterations/Elements: " << numit[i] << "/" << numele[i]
|
||||||
<< "\n ----------------------------------- \n";
|
<< "\n ----------------------------------- \n";
|
||||||
|
@@ -96,7 +96,7 @@ struct get_stable_vector
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<template<class> class GetContainer, class Allocator>
|
template<template<class> class GetContainer, class Allocator>
|
||||||
void stable_vector_test_template(unsigned int num_iterations, unsigned int num_elements, bool csv_output)
|
void stable_vector_test_template(std::size_t num_iterations, std::size_t num_elements, bool csv_output)
|
||||||
{
|
{
|
||||||
typedef typename GetContainer<Allocator>::type vector_type;
|
typedef typename GetContainer<Allocator>::type vector_type;
|
||||||
//std::size_t top_capacity = 0;
|
//std::size_t top_capacity = 0;
|
||||||
@@ -107,8 +107,8 @@ void stable_vector_test_template(unsigned int num_iterations, unsigned int num_e
|
|||||||
cpu_timer timer;
|
cpu_timer timer;
|
||||||
timer.resume();
|
timer.resume();
|
||||||
|
|
||||||
for(unsigned int r = 0; r != num_iterations; ++r){
|
for(std::size_t r = 0; r != num_iterations; ++r){
|
||||||
l.insert(l.end(), num_elements, MyInt(r));
|
l.insert(l.end(), num_elements, MyInt((int)r));
|
||||||
}
|
}
|
||||||
|
|
||||||
timer.stop();
|
timer.stop();
|
||||||
@@ -138,7 +138,7 @@ void stable_vector_test_template(unsigned int num_iterations, unsigned int num_e
|
|||||||
//Now preprocess ranges to erase
|
//Now preprocess ranges to erase
|
||||||
std::vector<typename vector_type::iterator> ranges_to_erase;
|
std::vector<typename vector_type::iterator> ranges_to_erase;
|
||||||
ranges_to_erase.push_back(l.begin());
|
ranges_to_erase.push_back(l.begin());
|
||||||
for(unsigned int r = 0; r != num_iterations; ++r){
|
for(std::size_t r = 0; r != num_iterations; ++r){
|
||||||
typename vector_type::iterator next_pos(ranges_to_erase[r]);
|
typename vector_type::iterator next_pos(ranges_to_erase[r]);
|
||||||
std::size_t n = num_elements;
|
std::size_t n = num_elements;
|
||||||
while(n--){ ++next_pos; }
|
while(n--){ ++next_pos; }
|
||||||
@@ -149,7 +149,7 @@ void stable_vector_test_template(unsigned int num_iterations, unsigned int num_e
|
|||||||
timer.stop();
|
timer.stop();
|
||||||
timer.start();
|
timer.start();
|
||||||
|
|
||||||
for(unsigned int r = 0; r != num_iterations; ++r){
|
for(std::size_t r = 0; r != num_iterations; ++r){
|
||||||
std::size_t init_pos = (num_iterations-1)-r;
|
std::size_t init_pos = (num_iterations-1)-r;
|
||||||
l.erase(ranges_to_erase[init_pos], l.end());
|
l.erase(ranges_to_erase[init_pos], l.end());
|
||||||
}
|
}
|
||||||
@@ -169,10 +169,10 @@ void stable_vector_test_template(unsigned int num_iterations, unsigned int num_e
|
|||||||
<< float(nseconds)/float(num_iterations*num_elements)/*
|
<< float(nseconds)/float(num_iterations*num_elements)/*
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " max capacity: "
|
<< " max capacity: "
|
||||||
<< static_cast<unsigned int>(top_capacity)
|
<< static_cast<std::size_t>(top_capacity)
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " remaining cap. "
|
<< " remaining cap. "
|
||||||
<< static_cast<unsigned int>(top_capacity - num_iterations*num_elements)
|
<< static_cast<std::size_t>(top_capacity - num_iterations*num_elements)
|
||||||
<< " (" << (float(top_capacity)/float(num_iterations*num_elements) - 1)*100 << " %)"*/
|
<< " (" << (float(top_capacity)/float(num_iterations*num_elements) - 1)*100 << " %)"*/
|
||||||
<< std::endl << std::endl;
|
<< std::endl << std::endl;
|
||||||
}
|
}
|
||||||
@@ -224,21 +224,21 @@ int main(int argc, const char *argv[])
|
|||||||
#define SIMPLE_IT
|
#define SIMPLE_IT
|
||||||
#ifdef SINGLE_TEST
|
#ifdef SINGLE_TEST
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
unsigned int numit [] = { 40 };
|
std::size_t numit [] = { 40 };
|
||||||
#else
|
#else
|
||||||
unsigned int numit [] = { 4 };
|
std::size_t numit [] = { 4 };
|
||||||
#endif
|
#endif
|
||||||
unsigned int numele [] = { 10000 };
|
std::size_t numele [] = { 10000 };
|
||||||
#elif defined(SIMPLE_IT)
|
#elif defined(SIMPLE_IT)
|
||||||
unsigned int numit [] = { 3 };
|
std::size_t numit [] = { 3 };
|
||||||
unsigned int numele [] = { 10000 };
|
std::size_t numele [] = { 10000 };
|
||||||
#else
|
#else
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
unsigned int numit [] = { 40, 400, 4000, 40000 };
|
std::size_t numit [] = { 40, 400, 4000, 40000 };
|
||||||
#else
|
#else
|
||||||
unsigned int numit [] = { 4, 40, 400, 4000 };
|
std::size_t numit [] = { 4, 40, 400, 4000 };
|
||||||
#endif
|
#endif
|
||||||
unsigned int numele [] = { 10000, 1000, 100, 10 };
|
std::size_t numele [] = { 10000, 1000, 100, 10 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Warning: range erasure is buggy. Vector iterators are not stable, so it is not
|
//Warning: range erasure is buggy. Vector iterators are not stable, so it is not
|
||||||
@@ -248,33 +248,33 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
if(csv_output){
|
if(csv_output){
|
||||||
print_header();
|
print_header();
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
stable_vector_test_template<get_stable_vector, StdAllocator>(numit[i], numele[i], csv_output);
|
stable_vector_test_template<get_stable_vector, StdAllocator>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
stable_vector_test_template<get_vector, StdAllocator>(numit[i], numele[i], csv_output);
|
stable_vector_test_template<get_vector, StdAllocator>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
stable_vector_test_template<get_stable_vector, AllocatorPlusV1>(numit[i], numele[i], csv_output);
|
stable_vector_test_template<get_stable_vector, AllocatorPlusV1>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
stable_vector_test_template<get_vector, AllocatorPlusV1>(numit[i], numele[i], csv_output);
|
stable_vector_test_template<get_vector, AllocatorPlusV1>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
stable_vector_test_template<get_stable_vector, AllocatorPlusV2>(numit[i], numele[i], csv_output);
|
stable_vector_test_template<get_stable_vector, AllocatorPlusV2>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
stable_vector_test_template<get_vector, AllocatorPlusV2>(numit[i], numele[i], csv_output);
|
stable_vector_test_template<get_vector, AllocatorPlusV2>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
stable_vector_test_template<get_stable_vector, AdPool2PercentV2>(numit[i], numele[i], csv_output);
|
stable_vector_test_template<get_stable_vector, AdPool2PercentV2>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
stable_vector_test_template<get_vector, AdPool2PercentV2>(numit[i], numele[i], csv_output);
|
stable_vector_test_template<get_vector, AdPool2PercentV2>(numit[i], numele[i], csv_output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
for(std::size_t i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
|
||||||
std::cout << "\n ----------------------------------- \n"
|
std::cout << "\n ----------------------------------- \n"
|
||||||
<< " Iterations/Elements: " << numit[i] << "/" << numele[i]
|
<< " Iterations/Elements: " << numit[i] << "/" << numele[i]
|
||||||
<< "\n ----------------------------------- \n";
|
<< "\n ----------------------------------- \n";
|
||||||
|
@@ -93,7 +93,7 @@ cpu_times time_it()
|
|||||||
std::sort(v.begin(), v.end());
|
std::sort(v.begin(), v.end());
|
||||||
sortTime.stop();
|
sortTime.stop();
|
||||||
rotateTime.resume();
|
rotateTime.resume();
|
||||||
std::rotate(v.begin(), v.begin() + v.size()/2, v.end());
|
std::rotate(v.begin(), v.begin() + std::ptrdiff_t(v.size()/2), v.end());
|
||||||
rotateTime.stop();
|
rotateTime.stop();
|
||||||
destructionTime.resume();
|
destructionTime.resume();
|
||||||
delete &v;
|
delete &v;
|
||||||
|
@@ -177,7 +177,7 @@ struct insert_near_end
|
|||||||
{
|
{
|
||||||
typedef typename C::iterator it_t;
|
typedef typename C::iterator it_t;
|
||||||
it_t it (c.end());
|
it_t it (c.end());
|
||||||
it -= static_cast<typename C::size_type>(c.size() >= 2)*2;
|
it -= static_cast<typename C::difference_type>(c.size() >= 2)*2;
|
||||||
c.insert(it, MyInt(i));
|
c.insert(it, MyInt(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -81,7 +81,7 @@ class node_allocator
|
|||||||
typedef std::ptrdiff_t difference_type;
|
typedef std::ptrdiff_t difference_type;
|
||||||
|
|
||||||
typedef boost::container::dtl::
|
typedef boost::container::dtl::
|
||||||
version_type<self_t, Version> version;
|
version_type<self_t, (unsigned int) Version> version;
|
||||||
|
|
||||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||||
typedef boost::container::dtl::
|
typedef boost::container::dtl::
|
||||||
|
@@ -184,19 +184,19 @@ int map_test_range()
|
|||||||
|
|
||||||
//Test construction from a range
|
//Test construction from a range
|
||||||
{
|
{
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i/2);
|
IntType i1(i/2);
|
||||||
IntType i2(i/2);
|
IntType i2(i/2);
|
||||||
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
|
|
||||||
StdValueType aux_vect2[MaxElem];
|
StdValueType aux_vect2[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
new(&aux_vect2[i])StdValueType(StdKeyType(i/2), StdMappedType(i/2));
|
new(&aux_vect2[i])StdValueType(StdKeyType(i/2), StdMappedType(i/2));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPairType aux_vect3[MaxElem];
|
IntPairType aux_vect3[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i/2);
|
IntType i1(i/2);
|
||||||
IntType i2(i/2);
|
IntType i2(i/2);
|
||||||
@@ -218,19 +218,19 @@ int map_test_range()
|
|||||||
if(!CheckEqualContainers(*pboostmultimap, *pstdmultimap)) return 1;
|
if(!CheckEqualContainers(*pboostmultimap, *pstdmultimap)) return 1;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i/2);
|
IntType i1(i/2);
|
||||||
IntType i2(i/2);
|
IntType i2(i/2);
|
||||||
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
|
|
||||||
StdValueType aux_vect2[MaxElem];
|
StdValueType aux_vect2[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
new(&aux_vect2[i])StdValueType(StdKeyType(i/2), StdMappedType(i/2));
|
new(&aux_vect2[i])StdValueType(StdKeyType(i/2), StdMappedType(i/2));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPairType aux_vect3[MaxElem];
|
IntPairType aux_vect3[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i/2);
|
IntType i1(i/2);
|
||||||
IntType i2(i/2);
|
IntType i2(i/2);
|
||||||
@@ -266,7 +266,7 @@ int map_test_step(MyBoostMap &, MyStdMap &, MyBoostMultiMap &, MyStdMultiMap &)
|
|||||||
|
|
||||||
{
|
{
|
||||||
//This is really nasty, but we have no other simple choice
|
//This is really nasty, but we have no other simple choice
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i/2);
|
IntType i1(i/2);
|
||||||
IntType i2(i/2);
|
IntType i2(i/2);
|
||||||
@@ -276,12 +276,12 @@ int map_test_step(MyBoostMap &, MyStdMap &, MyBoostMultiMap &, MyStdMultiMap &)
|
|||||||
typedef typename MyStdMap::value_type StdValueType;
|
typedef typename MyStdMap::value_type StdValueType;
|
||||||
typedef typename MyStdMap::key_type StdKeyType;
|
typedef typename MyStdMap::key_type StdKeyType;
|
||||||
typedef typename MyStdMap::mapped_type StdMappedType;
|
typedef typename MyStdMap::mapped_type StdMappedType;
|
||||||
StdValueType aux_vect2[MaxElem];
|
StdValueType aux_vect2[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
new(&aux_vect2[i])StdValueType(StdKeyType(i/2), StdMappedType(i/2));
|
new(&aux_vect2[i])StdValueType(StdKeyType(i/2), StdMappedType(i/2));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPairType aux_vect3[MaxElem];
|
IntPairType aux_vect3[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i/2);
|
IntType i1(i/2);
|
||||||
IntType i2(i/2);
|
IntType i2(i/2);
|
||||||
@@ -400,13 +400,13 @@ int map_test_insert(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boo
|
|||||||
|
|
||||||
{
|
{
|
||||||
//This is really nasty, but we have no other simple choice
|
//This is really nasty, but we have no other simple choice
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(i);
|
IntType i2(i);
|
||||||
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
IntPairType aux_vect3[MaxElem];
|
IntPairType aux_vect3[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(i);
|
IntType i2(i);
|
||||||
@@ -501,13 +501,13 @@ int map_test_erase(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boos
|
|||||||
//Initialize values
|
//Initialize values
|
||||||
{
|
{
|
||||||
//This is really nasty, but we have no other simple choice
|
//This is really nasty, but we have no other simple choice
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(-1);
|
IntType i1(-1);
|
||||||
IntType i2(-1);
|
IntType i2(-1);
|
||||||
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
IntPairType aux_vect3[MaxElem];
|
IntPairType aux_vect3[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(-1);
|
IntType i1(-1);
|
||||||
IntType i2(-1);
|
IntType i2(-1);
|
||||||
@@ -535,28 +535,28 @@ int map_test_erase(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boos
|
|||||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(-1);
|
IntType i1(-1);
|
||||||
IntType i2(-1);
|
IntType i2(-1);
|
||||||
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPairType aux_vect3[MaxElem];
|
IntPairType aux_vect3[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(-1);
|
IntType i1(-1);
|
||||||
IntType i2(-1);
|
IntType i2(-1);
|
||||||
new(&aux_vect3[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect3[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPairType aux_vect4[MaxElem];
|
IntPairType aux_vect4[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(-1);
|
IntType i1(-1);
|
||||||
IntType i2(-1);
|
IntType i2(-1);
|
||||||
new(&aux_vect4[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect4[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPairType aux_vect5[MaxElem];
|
IntPairType aux_vect5[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(-1);
|
IntType i1(-1);
|
||||||
IntType i2(-1);
|
IntType i2(-1);
|
||||||
@@ -599,13 +599,13 @@ int map_test_insert2(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &bo
|
|||||||
typedef typename MyStdMap::value_type StdPairType;
|
typedef typename MyStdMap::value_type StdPairType;
|
||||||
|
|
||||||
//This is really nasty, but we have no other simple choice
|
//This is really nasty, but we have no other simple choice
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(i);
|
IntType i2(i);
|
||||||
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
IntPairType aux_vect3[MaxElem];
|
IntPairType aux_vect3[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(i);
|
IntType i2(i);
|
||||||
@@ -813,7 +813,7 @@ int map_test_indexing(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &b
|
|||||||
stdmap.clear();
|
stdmap.clear();
|
||||||
stdmultimap.clear();
|
stdmultimap.clear();
|
||||||
|
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(i);
|
IntType i2(i);
|
||||||
@@ -844,14 +844,14 @@ int map_test_insert_or_assign_impl()
|
|||||||
{ //insert_or_assign test
|
{ //insert_or_assign test
|
||||||
MyBoostMap boostmap;
|
MyBoostMap boostmap;
|
||||||
StdMap stdmap;
|
StdMap stdmap;
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(MaxElem-i);
|
IntType i2(MaxElem-i);
|
||||||
new(&aux_vect[i])IntPairType(maybe_move(i1), maybe_move(i2));
|
new(&aux_vect[i])IntPairType(maybe_move(i1), maybe_move(i2));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPairType aux_vect2[MaxElem];
|
IntPairType aux_vect2[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(i);
|
IntType i2(i);
|
||||||
@@ -891,14 +891,14 @@ int map_test_insert_or_assign_impl()
|
|||||||
{ //insert_or_assign test with hint
|
{ //insert_or_assign test with hint
|
||||||
MyBoostMap boostmap;
|
MyBoostMap boostmap;
|
||||||
StdMap stdmap;
|
StdMap stdmap;
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(MaxElem-i);
|
IntType i2(MaxElem-i);
|
||||||
new(&aux_vect[i])IntPairType(maybe_move(i1), maybe_move(i2));
|
new(&aux_vect[i])IntPairType(maybe_move(i1), maybe_move(i2));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPairType aux_vect2[MaxElem];
|
IntPairType aux_vect2[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(i);
|
IntType i2(i);
|
||||||
@@ -964,14 +964,14 @@ int map_test_try_emplace(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap
|
|||||||
stdmap.clear();
|
stdmap.clear();
|
||||||
stdmultimap.clear();
|
stdmultimap.clear();
|
||||||
|
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(i);
|
IntType i2(i);
|
||||||
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPairType aux_vect2[MaxElem];
|
IntPairType aux_vect2[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(MaxElem-i);
|
IntType i2(MaxElem-i);
|
||||||
@@ -1055,20 +1055,20 @@ int map_test_merge(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boos
|
|||||||
stdmultimap.clear();
|
stdmultimap.clear();
|
||||||
|
|
||||||
{
|
{
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(i);
|
IntType i2(i);
|
||||||
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPairType aux_vect2[MaxElem];
|
IntPairType aux_vect2[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(MaxElem/2+i);
|
IntType i1(MaxElem/2+i);
|
||||||
IntType i2(MaxElem-i);
|
IntType i2(MaxElem-i);
|
||||||
new(&aux_vect2[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect2[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
IntPairType aux_vect3[MaxElem];
|
IntPairType aux_vect3[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(MaxElem*2/2+i);
|
IntType i1(MaxElem*2/2+i);
|
||||||
IntType i2(MaxElem*2+i);
|
IntType i2(MaxElem*2+i);
|
||||||
@@ -1102,20 +1102,20 @@ int map_test_merge(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boos
|
|||||||
stdmap.clear();
|
stdmap.clear();
|
||||||
stdmultimap.clear();
|
stdmultimap.clear();
|
||||||
{
|
{
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(i);
|
IntType i1(i);
|
||||||
IntType i2(i);
|
IntType i2(i);
|
||||||
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPairType aux_vect2[MaxElem];
|
IntPairType aux_vect2[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(MaxElem/2+i);
|
IntType i1(MaxElem/2+i);
|
||||||
IntType i2(MaxElem-i);
|
IntType i2(MaxElem-i);
|
||||||
new(&aux_vect2[i])IntPairType(boost::move(i1), boost::move(i2));
|
new(&aux_vect2[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
}
|
}
|
||||||
IntPairType aux_vect3[MaxElem];
|
IntPairType aux_vect3[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
IntType i1(MaxElem*2/2+i);
|
IntType i1(MaxElem*2/2+i);
|
||||||
IntType i2(MaxElem*2+i);
|
IntType i2(MaxElem*2+i);
|
||||||
|
@@ -764,16 +764,16 @@ int set_test ()
|
|||||||
stdmultiset.clear();
|
stdmultiset.clear();
|
||||||
|
|
||||||
{
|
{
|
||||||
IntType aux_vect[MaxElem];
|
IntType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
aux_vect[i] = i;
|
aux_vect[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntType aux_vect2[MaxElem];
|
IntType aux_vect2[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
aux_vect2[i] = MaxElem/2+i;
|
aux_vect2[i] = MaxElem/2+i;
|
||||||
}
|
}
|
||||||
IntType aux_vect3[MaxElem];
|
IntType aux_vect3[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
aux_vect3[i] = MaxElem*2/2+i;
|
aux_vect3[i] = MaxElem*2/2+i;
|
||||||
}
|
}
|
||||||
@@ -805,16 +805,16 @@ int set_test ()
|
|||||||
stdset.clear();
|
stdset.clear();
|
||||||
stdmultiset.clear();
|
stdmultiset.clear();
|
||||||
{
|
{
|
||||||
IntType aux_vect[MaxElem];
|
IntType aux_vect[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
aux_vect[i] = i;
|
aux_vect[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntType aux_vect2[MaxElem];
|
IntType aux_vect2[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
aux_vect2[i] = MaxElem/2+i;
|
aux_vect2[i] = MaxElem/2+i;
|
||||||
}
|
}
|
||||||
IntType aux_vect3[MaxElem];
|
IntType aux_vect3[(std::size_t)MaxElem];
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
aux_vect3[i] = MaxElem*2/2+i;
|
aux_vect3[i] = MaxElem*2/2+i;
|
||||||
}
|
}
|
||||||
|
@@ -124,14 +124,14 @@ struct string_literals<wchar_t>
|
|||||||
{ return L"LongLongLongLongLongLongLongLongLongLongLongLongLongString"; }
|
{ return L"LongLongLongLongLongLongLongLongLongLongLongLongLongString"; }
|
||||||
static wchar_t Char()
|
static wchar_t Char()
|
||||||
{ return L'C'; }
|
{ return L'C'; }
|
||||||
static void sprintf_number(wchar_t *buffer, unsigned int number)
|
static void sprintf_number(wchar_t *buffer, unsigned long number)
|
||||||
{
|
{
|
||||||
//For compilers without wsprintf, print it backwards
|
//For compilers without wsprintf, print it backwards
|
||||||
const wchar_t *digits = L"0123456789";
|
const wchar_t *digits = L"0123456789";
|
||||||
wchar_t *buf = buffer;
|
wchar_t *buf = buffer;
|
||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
unsigned rem = number % 10;
|
unsigned long rem = number % 10;
|
||||||
number = number / 10;
|
number = number / 10;
|
||||||
|
|
||||||
*buf = digits[rem];
|
*buf = digits[rem];
|
||||||
|
Reference in New Issue
Block a user