Can we have absolute namespace in function definition if return type is an object in C++?
问题 Let us consider a function bar declared in namespace foo which returns a std::vector< float > (but also works with other objects). // header.h #include <vector> namespace foo { ::std::vector< float > bar(); } Compiling its definition using relative namespace works. #include "header.h" ::std::vector< float > foo::bar() { } However, compiling its definition using absolute namespace does not work. #include "header.h" ::std::vector< float > ::foo::bar() { } Return error from GCC is function.cpp:3