"::var" simply specifies that you want to use the "var" that is in the global namespace, rather than any entity with the same name in a different namespace. Consider:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
int var = 10; // Global variable
namespace myNameSpace
{
int var = 5;
}
namespace myNameSpace
{
int main()
{
std::cout << ::var << std::endl; // Outputs "10"
std::cout << myNameSpace::var << std::endl; // Outputs "5"
std::cout << var << std::endl; // COMPILER ERROR - var is ambiguous
}
}
I don't think there's any performance improvement using ::var - it simply disambiguates the name.