r/cpp • • 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

149 comments sorted by

View all comments

Show parent comment

1

u/hedayatvk Apr 19 '20

Well, actually you can use Boost Parameter library to have named arguments in C++:
https://www.boost.org/doc/libs/1_72_0/libs/parameter/doc/html/index.html

8

u/fransinvodka Apr 19 '20

That library, although being really cool and awesome, is quite heavy and not-so-easy to use in the beginning. I would use it in my personal program if I feel like I need functions with tons of arguments, but no way I would add it to my library as a dependency unless really really needed (for example, a library of machine learning).

I'd just like to have a language-level feature instead of a monster library that's quite hard to use

2

u/hedayatvk Apr 20 '20

Yeah, I see :) Just wanted to mention the possibility. I've not used it myself too.