Is `using namespace std :: placeholders' inappropriate?

From § 2.10.3.2:

Each identifier starting with an underscore is reserved for implementation for use as a name in the global namespace.

To this end, is this standard program compliant? How does he do it _1, etc. Accessible from the global namespace? Or is this normal because it std::placeholdersis considered an "implementation"? Or is this normal because it _1is not actually in the global namespace? Something else?

using namespace std::placeholders;
int main(){}
+4
source share
1 answer

, . , using - , , using.

++ 11, 7.3.4:

2 - , , using- use. (3.4.1) , -, . [: "" " ". - ]

3 - , ....

, " ", " " .. , .

, 3.4.3.2 ( ):

2 X m, S (X, m) : S '(X, m) - m X X (7.3.1). S '(X, m) , S (X, m) S '(X, m); S (X, m) S (N i, m) N i nominated X .

I.e., -.

, using , _ Undefined Behavior.

+7

Source: https://habr.com/ru/post/1570880/


All Articles