-
is it correct that we dont need
::before qHash in line 6No.
Without
::, the compiler will not be able to find the correctqHashfunction. Unary scope operator::say that we need to call a function from the global scope, but not from the current namespace.According to the c++03 standard 3.4.3.4:
A name prefixed by the unary scope operator :: (5.1) is looked up in global scope, in the translation unit where it is used. The name shall be declared in global namespace scope or shall be a name whose declaration is visible in global scope because of a using-directive (3.4.3.2). The use of :: allows a global name to be referred to even if its identifier has been hidden (3.3.7).
Edited by frostasm
Please register or sign in to comment