Let's say I have this class:
class Foo {
public:
void member(std::string s);
void member(int64_t &n);
};
Now I want to do some thing like
int64_t value = 5;
Foo f;
f.member(value);
The problem is that the compiler (at least GCC) gets confused & believes I'm trying to call member with a string using the char* constructor:
invalid conversion from 'int64_t' to 'const char*
How could I go about calling the actual member function I want without changing the method signature? Are templates the only solution? I have tried casting without any help (which shouldn't matter since the type is already unambiguous).
Sorry - found the mistake.
The declaration was:
class Foo {
public:
void member(std::string s);
void member(int64_t &n);
};
Removing the by-ref solved it.