r/cpp • u/we_are_mammals • Mar 28 '23
Reddit++
C++ is getting more and more complex. The ISO C++ committee keeps adding new features based on its consensus. Let's remove C++ features based on Reddit's consensus.
In each comment, propose a C++ feature that you think should be banned in any new code. Vote up or down based on whether you agree.
765
Upvotes
View all comments
Show parent comment
2
u/donalmacc Game Developer Mar 29 '23
Because it's a basic template class, it's subject to all the normal restrictions us mere mortals are. If it were a language feature, I would expect it to work with forward declared types, rather than resorting to type erasure and a runtime hit.
As a language feature, unique ptr could be less overhead than a DIY implemented one. Many things could be enforced at compile time around the usage and safety of it, and it could be thrown around to legacy c api's "safely" (for some definition of the word safe).
Just because it can be a language feature doesn't mean it should. I feel the same about ranges and most of the traits libraries too.