Confusion About C++ Global Namespace -


from understanding, appending :: front of namespace refers global namespace, regardless of using statements or parent namespaces. if case, , haven't mis-understood anything, why such code compile (at least in visual studio):

namespace foo {     namespace bar {         class x;     } }  using namespace foo; int main(void) {     ::bar::x x; } 

using namespace foo; brings contents of namespace foo context of current namespace.

since namespace bar among contents of namespace foo , current namespace on line using statement global namespace, namespace bar brought context of global namespace.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -