Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"C++ Smart Pointers and Arrays" by Bartlomiej Filipek

38 views
Skip to first unread message

Lynn McGuire

unread,
Oct 26, 2021, 4:55:26 PM10/26/21
to
"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."

Lynn

Richard

unread,
Nov 8, 2021, 3:20:37 PM11/8/21
to
[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:
It's so useful they called it std::vector.
(No, I have not read the article)
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <http://terminals-wiki.org>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>

Paavo Helde

unread,
Nov 8, 2021, 4:16:21 PM11/8/21
to
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).


0 new messages