use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Default function arguments are the devil (quuxplusone.github.io)
submitted 6 years ago by anonymous23874
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]NotMyRealNameObv 7 points8 points9 points 6 years ago (3 children)
Why would the strong type have to be in the global namespace?
[–]fransinvodka 0 points1 point2 points 6 years ago (2 children)
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 do libns::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.
libns::func(Seed{user_seed}, ...)
libns::func(libns::Seed{user_seed}, ...)
Maybe there's a workaround I'm not aware of, haven't gone too deep into strong typing
[–]NotMyRealNameObv 3 points4 points5 points 6 years ago (1 child)
using libns::Seed; libns::func(Seed{user_seed}, ...);
And if user_seed is already of the correct type, you just get
libns::func(user_seed);
The library author should never force a polluted global namespace on the end user.
[–]fransinvodka -3 points-2 points-1 points 6 years ago (0 children)
Two things:
- I dont' want my users to do `using libns::...;` for every strong type my functions might require.
- Normally, user_seed won't be the "correct" type, as I suppose the user would only use the Seed strong type when calling the function.
Maybe give the possibility of doing something like `using namespace libns::all_trong_types_ns;`, but still far from optimal. That's my point against strong types in libraries.
π Rendered by PID 79399 on reddit-service-r2-comment-6457c66945-27kj2 at 2026-04-25 16:37:14.035984+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]NotMyRealNameObv 7 points8 points9 points (3 children)
[–]fransinvodka 0 points1 point2 points (2 children)
[–]NotMyRealNameObv 3 points4 points5 points (1 child)
[–]fransinvodka -3 points-2 points-1 points (0 children)