fix agg::pod_array and pod_vector move constructors

These were added with #4031, and probably not used in the end, as Mapnik
compiles and all tests pass without them. However, they might be useful,
so I'm only removing bad calls to deallocate with uninitialized values,
and doing proper member initialization.
This commit is contained in:
Mickey Rose 2019-09-22 23:29:13 +02:00
parent 162ac80675
commit fdf60044c3

View file

@ -124,11 +124,10 @@ namespace agg
memcpy(m_array, v.m_array, sizeof(T) * m_size);
}
pod_array(self_type && rhs)
pod_array(self_type && rhs) :
m_array(rhs.m_array),
m_size(rhs.m_size)
{
pod_allocator<T>::deallocate(m_array, m_size);
m_array = rhs.m_array;
m_size = rhs.m_size;
rhs.m_array = nullptr;
rhs.m_size = 0;
}
@ -284,12 +283,11 @@ namespace agg
}
//------------------------------------------------------------------------
template<class T> pod_vector<T>::pod_vector(pod_vector<T> && rhs)
template<class T> pod_vector<T>::pod_vector(pod_vector<T> && rhs) :
m_size(rhs.m_size),
m_capacity(rhs.m_capacity),
m_array(rhs.m_array)
{
pod_allocator<T>::deallocate(m_array, m_capacity);
m_size = rhs.m_size;
m_capacity = rhs.m_capacity;
m_array = rhs.m_array;
rhs.m_size = 0;
rhs.m_capacity = 0;
rhs.m_array = nullptr;