I am looking for a C++ data type similar to std::vector
but without the overhead related to dynamic resizing. The size of the container will remain constant over its lifetime. I considered using boost::array
, however, that is not appropriate because it requires the size of the array to be known at compile time, which is not the case in my situation.
Measure if the dynamic resizing has really any performance impact before using anything non-standard.
Tip: With vector.reserve there will never be any array-reallocation.
There's no overhead in reallocation if you don't reallocate std::vector. So either:
std::vector x(100)
)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With