I have a delima. I'm using wrapper classes for native types, however, when using the wrapper types as function arguments, the implicit conversion for char pointer to bool keeps causing the compiler to issue an ambiguous function call error:
class VBool
{
public:
VBool(bool b):value(b){}
template<class T>
VBool(T)=delete;
private:
bool value;
};
class VString
{
public:
VString(const char* str):value(str){}
private:
std::string value;
};
void processVType(VBool vb){}
void processVType(VString vs){}
int main()
{
processVType(""); // rejected as ambiguous by compiler.
return 0;
}
Now the compiler allows: VBool b = true; And correctly rejects: VBool b = "string";
But how do I get the compiler to correctly identify the intended function version to be called?
Note: I'm using VCC compiler with language standard for C++17 enabled.