logoalt Hacker News

HeliumHydrideyesterday at 7:19 PM1 replyview on HN

auto_ptr was effectively split into std::unique_ptr and std::shared_ptr. The problem was that before C++11, there wasn't a way to distinguish between copy assignment and move assignment.


Replies

eskayesterday at 7:24 PM

Correct. But the C++ language is not a language in which one should just say “screw it” and overload the assignment operator of all things while breaking its contract. Stuff like this is why many purists argue that operator overloading shouldn’t be a thing, because it can lead to shenanigans like this.

show 1 reply