I made a lib to parse JSON content with XCode and the main class JSONObject
has the operator=
overloaded, as you can see:
class JSONObject
{
//...
public:
JSONObject();
~JSONObject();
//...
void operator=(int);
void operator=(long);
void operator=(float);
void operator=(double);
void operator=(bool);
void operator=(std::string);
//...
};
The issue here is that at the moment of use operator=(string)
the operator=(bool)
is invoked:
JSONObject nItem;
nItem = "My New Item"; // <--- Here is what the problem is founded.
innerObj["GlossSeeAlso"]+= nItem;
The workaround that i found to "fix" this problem was specify the string type:
nItem = (string)"My New Item"; //"Fix 1"
nItem = string("My New Item"); //"Fix 2"
The lib and sample was compiled with:
Apple LLVM version 8.0.0 (clang-800.0.38)
The complete code can be founded here.
I will appreciate any help to understand this issue, why the operator=(bool)
is invoked instead of operator=(string)
.