I have this in a header:
double commonFunction( ... )
{ /*...*/ }
namespace F2
{
double impactFactor( ... )
{ /*...*/ }
double func( ... )
{ /*...*/ }
double F2( ... )
{ /*...*/ }
}
namespace FL
{
double impactFactor( ... )
{ /*...*/ }
double func( ... )
{ /*...*/ }
double FL( ... )
{ /*...*/ }
}
And I would like to access the F2 and FL functions from the global namespace. I tried adding this to the end of the header (or after an include, doesn’t matter):
using F2::F2;
using FL::FL;
I’m sure this works when the function names differ from the namespace names, but why does this not work and how can I fix it? Thanks
PS: I can’t put the functions outside their namespace, because that would lead to a redefined symbol (F2 and FL, as both namespace and function).
UPDATE: for those cursing me, here’s what I did. Since this is a scientific formula header, and a good short namespace name is hard to find I named the namespaces F2 and FL and the functions themselves f2 and fL.
Because,
usingbrings every declaration with given name into scope, so if you already have two or more declaration with one name (in this casenamespace f1), it will complain.And it has nothing to do with the name of the namespace and function being the same.
Even this will generate the same error: