Here I am doing more stuff with my "any" type.
I'm overloading the istream operator right now... I can't figure out why it isn't working right.
As far as the function itself, that works. Locally, the commented out any_cast line returns the correct value.
But it isn't acting like it actually changed the passed "operand"... because it doesn't do a thing if you try to use any_cast outside of the overload.
Any ideas as to what is wrong? Thanks!
And if it does work, I get giberish characters.Code:istream& operator >>(istream & is, any & operand) //precondition: input stream is open for reading //postcondition: the next string from input stream is has been read // and stored in str { char temp[81] = ""; // not longer than screen length char ch = 0; int i = 0; while (i <= 80 && is.get(ch) && ch != '\n') { temp[i++] = ch; } temp[i] = '\0'; operand = temp; //cout << any_cast<char*>(operand) << endl; return is; }



LinkBack URL
About LinkBacks


