A similar question to this
C++ Function Overloading Similar Conversions
has been asked and i understand the general premise of the problem. Looking for a solution.
I have 2 overloaded functions:
virtual IDataStoreNode* OpenNode(const char *Name, bool bCreateIfNotExist,int debug=0) { return 0;
}
virtual IDataStoreNode* OpenNode(const char* Name,int debug=0) const { return 0; }
From the errors it would appear that bool and int cannot be used to distinguish function overloads.
The question is , is there a way to work around this?
boolandintcan be used to distinguish function overloads. As one would expect,boolarguments will preferbooloverloads andintarguments –intoverloads.Judging by the error message (I assume that the title of your question is a part of the error message you got), what you are dealing with is the situation when the argument you supply is neither
boolnorint, yet conversions toboolandintexist and have the same rank.For example, consider this
The first two calls will resolve successfully and in expected manner. The third call will not resolve, because the argument type is actually
unsigned int, which however supports implicit conversions to bothboolandintthus making the call ambiguous.How are you calling your functions? Show us the arguments you are trying to pass.