I have been assigned to implement a string class and I am having a hard time with the >> operator overload.
Header File:
std::istream& operator >>(std::istream& ins, obstring& target);
Implementation:
std::istream& operator >>(std::istream& ins, obstring& target)
// Postcondition: A string has been read from the istream ins, and the
// istream ins is then returned by the function. The reading operation
// skips white space (i.e., blanks, newlines, tabs) at the start of ins.
// Then the string is read up to the next white space or the end of the
// file. The white space character that terminates the string has not
// been read.
// Library facilities used: iostream
{
char a;
ins >> a;
while ((a != " ") || (a != ""))
{
target += a;
ins >> a;
}
return ins;
}
When compiling I get the error:
ISO C++ forbids comparison between pointer and integer
This is referencing the line 13 in the code block above.
Any insight into what could be the problem here will be appreciated.