Use value-initialized pointers when null is required, as conversion from literal 0 is not guaranteed in smart pointers.

This commit is contained in:
Ion Gaztañaga
2016-07-31 23:16:08 +02:00
parent 8f136bc909
commit b6d3906895

View File

@@ -380,7 +380,7 @@ struct vector_alloc_holder
, m_capacity() , m_capacity()
{ {
if(initial_size){ if(initial_size){
pointer reuse = 0; pointer reuse = pointer();
m_start = this->allocation_command(allocate_new, initial_size, m_capacity = initial_size, reuse); m_start = this->allocation_command(allocate_new, initial_size, m_capacity = initial_size, reuse);
} }
} }
@@ -393,7 +393,7 @@ struct vector_alloc_holder
, m_capacity() , m_capacity()
{ {
if(initial_size){ if(initial_size){
pointer reuse = 0; pointer reuse = pointer();
m_start = this->allocation_command(allocate_new, initial_size, m_capacity = initial_size, reuse); m_start = this->allocation_command(allocate_new, initial_size, m_capacity = initial_size, reuse);
} }
} }
@@ -525,7 +525,7 @@ struct vector_alloc_holder
void priv_first_allocation(size_type cap) void priv_first_allocation(size_type cap)
{ {
if(cap){ if(cap){
pointer reuse = 0; pointer reuse = pointer();
m_start = this->allocation_command(allocate_new, cap, cap, reuse); m_start = this->allocation_command(allocate_new, cap, cap, reuse);
m_capacity = cap; m_capacity = cap;
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS