-
Notifications
You must be signed in to change notification settings - Fork 771
Which codeblocks should contain "namespace std"? #1168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
My gut feeling is that we generally want |
Rough overview:
That seems we're missing 58 "namespace" things. $ sed -n '/rSec.*{Class template/,+6 { /namespace/,+6 { /class/p } }' *.tex | wc -l |
Ah, that's quite a lot actually, to a point where I'd say there's no clear preference. |
However, I do find the arguments above compelling, in particular the fact that some classes are in nested namespaces. Adding |
IMHO consistently showing the namespace would be better. |
I agree, I would certainly like the namespace to show, but if this is more than a handful of local fixes, then I'm not in a hurry to get onto it just now. |
The verbose part is the indentation changes that come along with |
I have a slight hesitation with this direction: for itemdecls, we don't list the namespace (nor class) and it would not be useful to do so. Consistency would indicate that we don't list the However, the argument that we have nested namespaces within I suggest that for now we normalize towards including the namespace for class definitions (and enum definitions) but not for function declarations and similar things in itemdecls. As a more general rule: if the declaration itself is a definition-like thing providing specification in and of itself, then it gets a namespace. If it's just a backreference to something specified elsewhere to anchor the words to a specific declaration, then it doesn't. Consistently applied, that'd mean we'd write either:
or
(but I'm not suggesting we actually ever use the first formulation). This has a certain pleasing parallel with the rules of C++ for out-of-line vs inline declarations. |
That seems like a good general rule. Concretely, I think |
Header synopses always contain
namespace std { ...
. When we describe the header content in detail, we often repeatnamespace std {
, e.g. in "Class template vector".However, we sometimes don't repeat the namespace for specifications. Examples are "optional", "polymorphic_memory_resource", and "linear_congruential_engine".
(Note that I am not talking about itemdecls; those never state the namespace.)
We should decide whether to state the namespace in those detailed definitions, and then apply that style consistently and record it in the wiki.
I think the majority use at the moment is to state the namespace, but that doesn't need to be a deciding factor. Note also that some class templates live in further nested namespaces, so there may be some value in being explicit.
The text was updated successfully, but these errors were encountered: