basic_string<char> bStr("bstring");
CsString<10> csStr("cstring");
if (bStr == csStr)
cout << "strings are equal" << endl;
else
cout << "strings are not equal" << endl;
I get this error message:
m:\2t8lb_commonobjects_r3.2_dev\cade_core\csobjects\src est_bstring.cpp(16) : error C2678: binary ‘==’ : no operator defined which takes a left-hand operand of type ‘class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >’ (or there is no acceptable conversion)
//=============================================================================
template <unsigned long SIZE>
CsString<SIZE>& CsString<SIZE>:: operator<<(const basic_string<char>& rh)
{
m_fnAppend(rh.c_str());
return *this;
}
Called with:
basic_string bStr(“bstring”);
cout << bStr << endl;
Error:
M:\2t8lb_CommonObjects_R3.2_Dev\CADE_CORE\CsObjects\src est_bstring.cpp(11) : error C2679: binary ‘<<’ : no operator defined which takes a right-hand operand of type ‘class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >’ (or there is no acceptable conversion)
I’ll try to come back later when I have a chance, but first of all, if you want to overload the insertion operator and chain it like this: cout << bStr << endl;
You need it to return on ostream reference. A super-vague prototype looks like this: ostream& operator<<(ostream &stream, someObjectToOut o);