Consider the following code:
#include <iostream> inline namespace N1 { int x = 2; } int x = 1; int main() { std::cout << N1::x; std::cout << x; return 0; }
This obviously gives me an error on std::cout << x;
the reference to x is ambiguous.
::x also does not work.
I understand why this is happening, but how can I solve this problem without renaming or deleting variables or namespaces? Or is this the only solution?
c ++
Holyblackcat
source share