logoalt Hacker News

Maxatartoday at 12:37 PM1 replyview on HN

So data structures like std::vector should never be copied - period?


Replies

HarHarVeryFunnytoday at 3:42 PM

I think the parent is just referring to pointer types, not anything (like std::vector) that may use pointers internally.

This "std::indirect" tries to have value semantics, but in fact it's just another type of smart pointer and uses pointer syntax (pimpl->foo : forced since C++ allows "->" as a user defined operator name, but not ".").

But it's a weird sort of "pointer" given this copying behavior, which is maybe why they didn't give it a "_ptr" name.