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

3

u/flashmozzg Apr 19 '20

"is this thing invocable with the given arguments?"

Not exactly? At least as far as I see it you can only ask "if thing of this type is callable with args of these types". Default arguments obviously are not part of the type.

I think with C++20 you can just use requires as a way to SFINAE test whether some thing makes sense, i.e. https://godbolt.org/z/wdPrgi