3 ms·
>If we have to call a non-trivial destructor for the item being removed, the check stops being significant. This is a complicated cost model which compilers us
by fooker 4y ago
>If we have to call a non-trivial destructor for the item being removed, the check stops being significant.
This is a complicated cost model which compilers usually avoid.
>The compiler should also be smart enough.
It isn't.
> That's what a sane API would look like.
Awesome, there is nothing stopping you from creating your own functions which add this check.
- mike_hock 4y ago> It isn't. It definitely is. Go try it on godbolt. > Awesome, there is nothing stopping you from creating your own functions which add this check. Thanks for your amazing insight. STL is lacking? Nothing is stopping us from writing our own functions. STL is garbage? Nothing is stopping us from writing our own replacement. The whole language is garbage? Nothing is stopping us from creating a new one from scratch. Really, you've found the solution to everything.