3 ms·
It’s not so much the ‘std’ thing, it’s the double colon that is an abomination. I never understood why they couldn’t simply use a single dot like some other lan
by Koshkin 3y ago
It’s not so much the ‘std’ thing, it’s the double colon that is an abomination. I never understood why they couldn’t simply use a single dot like some other languages have done.
- Maxatar 3y agoTo resolve ambiguities due to the fact that in C, type names live in a separate namespace from variable names so that it's possible to have a variable with the same name as a type. C++ inherits this distinction so that it is possible to write the following: struct foo { int x; }; struct bar : foo { ::foo foo; }; bar b; b.foo::x = 1; b.foo.x = 2; The b.foo::x and b.foo.x are two different x's, and the only way to disambiguate them is through the use of the . or the ::