I have a very simple problem: Somewhere there is a function
int size (const C & c)
which is found, at least, by argument-dependent name lookup. Now the problem:
struct B
{
int size () { /* ... */ }
void doSomething (const C & c)
{
int x = size (c); // <----------- problem!
// ...
}
}
This does not work, as name lookup stops after having found the member function.
What do I have to write in the indicated line such that not the member function is tried to be called, but that, rather, the compiler does whatever it would do if the member function did not exist?
Note that the solution is not writing ::size
, as this prevents argument-dependent name lookup and only works if I know where size
is declared.
Further complication:
I know that for each relevant type T
for which I use the below templated member function B::doSomething
, somewhere there will be a function
int size (const T & t)
which is found, at least, by argument-dependent name lookup. B
looks as follows:
struct B
{
int size () { /* ... */ }
template<class T>
void doSomething (const T & t)
{
int x = size (t); // <----------- problem!
// ...
}
}
I want the non-member function to be called (which I am sure it exists, but which I cannot be sure about where it lives).