Hi,
Fit library make use of constexpr
function object. These function objects don't work well
when the user is requiring ADL and the same symbol is used. Next
follows an example
namespace N1 {
struct F1 {
void operator()(int) const {}
};
constexpr F1 f;
}
namespace N2 {
struct A{};
void f(A) {}
}
namespace N3 {
struct A{};
void f(A) {}
}
The following find N3::f(A)
{
N3::A a;
f(a); // calls N3::f(A)
}
Adding another namespace that doesn't introduce a
better match works yet
{
N3::A a;
using namespace N2;
f(a); // calls N3::f(A)
}
However a namespace that contains a function object with the
smae name even if overload doesn't match make the code
ill-formed
{
N3::A a;
using namespace N1;
f(a); // compile fails
}
: error: reference to 'f' is ambiguous
f(a);
^
: note: candidate found by name lookup is 'N1::f'
constexpr F1 f;
^
: note: candidate found by name lookup is 'N3::f'
void f(A) {}
boost::fit contains a lot of such a function objects variables, so
this means that the user should be careful while introducing the
namespace boost::fit, as ADL will not be used for a lot of
symbols.
This is not something specific to Fit library, Hana and range-v3
make use of a lot of such global function objects.
A good stryle will be to use
Fit/Hana function objects always qualified with their respective
namespapce or an alias.
I believe it will be worth adding something in the documentation
preventing the users of this case.
Best,
Vicente