3 ms·
Smart pointers and so on? As I said in another sibling reply, I have experience in almost everything from C# down to C, functional, etc., with the (almost) sole
by Gene_Parmesan 7y ago
Smart pointers and so on? As I said in another sibling reply, I have experience in almost everything from C# down to C, functional, etc., with the (almost) sole exception of C++, so I'm always curious in understanding that language's idioms.
The idea of needing to employ the standard library to avoid using a core feature of the language seems... interesting? I guess.
- detaro 7y agoYou couldn't implement the standard library or libraries providing tools like the standard library without having "new" etc available in the language. And of course C++ hasn't had all of this from the start, some use cases still like or need to avoid using too much of the standard library, ...
- ncmncm 7y agoMost such cases are delusory. That said, anyone who needs more than a couple of std::shared_ptr in a program is probably Doing It Wrong. I rarely find a use for them; prevalence of std::shared_ptr is often called Java Disease. Similarly, for std::unique_ptr in public interfaces. Finally: implementers of the Standard Library are not confined to using only Standard facilities, so in fact they do not actually need op new. In practice, they use it, but always correctly so you don't typically need it at all.
- zabzonk 7y agoMostly using collection classes such as std::string, std::vector, std::map and so on, but also using smart pointers such as std::unique_ptr for lower-level stuff. And of course, the Standard Library is built on those "core features" - it just makes them easier and safer to use.