You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to improve complexity of circular_buffer<T>::resize(new_size, item) in the case where T is scalar ?
Currently, complexity is always linear.
It would be nice to have constant complexity when T is a scalar type and no reallocation happens (ie. new_size <= capacity()).
When we want to reduce size of buffer (ie. new_size < size()), you could call erase_end(n) internally which already implements an optimization for scalar types.
When we want to increase size of buffer, you could optimize for scalar types by calling std::memset() at most 2 times.
The text was updated successfully, but these errors were encountered:
Hello,
Would it be possible to improve complexity of
circular_buffer<T>::resize(new_size, item)
in the case whereT
is scalar ?Currently, complexity is always linear.
It would be nice to have constant complexity when
T
is a scalar type and no reallocation happens (ie.new_size <= capacity()
).When we want to reduce size of buffer (ie.
new_size < size()
), you could callerase_end(n)
internally which already implements an optimization for scalar types.When we want to increase size of buffer, you could optimize for scalar types by calling
std::memset()
at most 2 times.The text was updated successfully, but these errors were encountered: