08.11.2021 22:20 Richard kirjutas:
> [Please do not mail me a copy of your followup]
>
> Lynn McGuire <
lynnmc...@gmail.com> spake the secret code
> <sl9pvf$rcv$
1...@dont-email.me> thusly:
>
>> "C++ Smart Pointers and Arrays" by Bartlomiej Filipek
>>
https://www.cppstories.com/2021/smartptr-array/
>>
>> "Smart pointers are very versatile and can hold pointers not only to
>> single instances but also to arrays. Is that only a theoretical use
>> case? or maybe they might be handy in some cases? Let’s have a look."
>
> It's so useful they called it std::vector.
> (No, I have not read the article)
+1
That said, I have had some situations where the profiler identified the
zero initialization of a std::vector as a bottleneck. My solution was to
define a "noinit_buffer" class using malloc(), but in retrospect this
feels much like C++20's std::make_unique_for_overwrite<T[]>(n).