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
1
u/fransinvodka Apr 19 '20
Let me be clearer. Suppose I want my function to be called with a seed, so the user would do something like
libns::func(Seed{user_seed}, ...), but if I define the strong type inside the library's namespace, the user then must dolibns::func(libns::Seed{user_seed}, ...), which we can agree is not that aesthetic as we'd like. The only solution would then be defining it in the global namespace, and that's what I meant.Maybe there's a workaround I'm not aware of, haven't gone too deep into strong typing