According to the C++ Standard (6.3.6 Namespace scope)
2 A namespace member can also be referred to after the :: scope
resolution operator (8.1) applied to the name of its namespace or the
name of a namespace which nominates the member’s namespace in a
using-directive; see 6.4.3.2.
And the global namespace does not have a name.
So this record
::flann::SearchParams param_k_;
denotes that the name flann
should be searched in the global namespace or in one of its inline namespaces. Or if the name was not found then all namespaces nominated in using directives implicitly (as for an unnamed namespace) or explicitly (recursively) in the global namespace are searched.
Here is a demonstrative program
#include <iostream>
int x = 1;
inline namespace N1
{
int y = 2;
}
int main()
{
int x = 10;
int y = 20;
std::cout << "x + ::x = " << x + ::x << '\n';
std::cout << "y + ::y = " << y + ::y << '\n';
return 0;
}
Its output is
x + ::x = 11
y + ::y = 22
As the inline namespace of the global namespace has its own name then the last statement can be also rewritten like
std::cout << "y + N1::y = " << y + N1::y << '\n';
Or even like
std::cout << "y + ::N1::y = " << y + ::N1::y << '\n';
Below there is a more complicated example
#include <iostream>
int x = 1;
inline namespace N1
{
int y = 2;
}
namespace
{
int y = 3;
}
int main()
{
int x = 10;
int y = 20;
std::cout << "x + ::x = " << x + ::x << '\n';
std::cout << "y + ::y = " << y + ::y << '\n';
return 0;
}
There is no ambiguity relative to the qualified name lookup of the name ::y
because the first set of namespaces that are searched is the nominated namespace (in this case the global namespace) and its inline namespaces. And the name y is found in this set of namespaces. Otherwise the compiler would continue to search the name y
also in unnamed namespaces of the global namespace.