Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QByteArray - Ambiguous call to push_back???
Can anyone tell me why this line of code:
causes this error:
The call to member function 'push_back' is ambiguous?
VRonin last edited by
This post is deleted!
Your zero (0x00) can be converted to a char or a pointer, so the compiler don't know what to to.
If you want to append a char, use
data.push_back(char(0x00));Appending a nullpointer does not really makes sense, does it?!
VRonin last edited by VRonin
intcan bind to multiple overloads of
QByteArray::push_backyou have to tell the compiler your byte constant is of type
charand not the default
@aha_1980 That makes total sense. I did notice that when I cast 0x00 to char, it worked. I just didn't understand the reason. Thank you for the explanation!!!
@VRonin Thank you for the explanation!