r/cpp • u/anonymous23874 • Apr 19 '20
Default function arguments are the devil
https://quuxplusone.github.io/blog/2020/04/18/default-function-arguments-are-the-devil/
90
Upvotes
r/cpp • u/anonymous23874 • Apr 19 '20
View all comments
Show parent comment
5
u/Ameisen vemips, avr, rendering, systems Apr 19 '20
I have a proposal sitting around to allow you to use
defaultas a keyword for using the default type value (like{}) or using the declared default value of a parameter if it exists. Could extend it to supportdefault...or such for a case like that.Couple this with optional argument compile time detection... you can have very powerful functions or constructors.