Let\'s take the following code:
#include // std::string
using namespace std;
int main() {
//const::int i = 42; -> Error: \"expected
::something
tells the compiler to look for something
in global namespace, but int
is keyword (not defined anywhere), while string
(resp. std::string
) is class defined in
so your code is equivalent to this one
#include // std::string
using namespace std;
int main() {
//const ::int i = 42; -> Error: "expected id-expression before 'int'"
const ::string str = "Foo";
}