Remix.run Logo
smallstepforman 4 days ago

Oh god, what monstrocity have we created?!?

All this complexity follows unique_ptr and copy constructor madness.

Anything with pointers with ownership should never be copied - period. Reference pointers - OK if scope/lifetime is known.

Can we have c++11 lite?

pjmlp 3 days ago | parent | next [-]

Yes, configure clang-tidy as such.

Maxatar 4 days ago | parent | prev [-]

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

HarHarVeryFunny 4 days ago | parent [-]

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.