c++ - Using my own String class with the << operator -


i looking way use ostream custom string class , overload operator << stream buffer can flush anywhere want (in case gonna printed in window)

i'm reasonably new inner workings of iostream's understanding method i've seen of making std::stringbuf base of custom stringstream not work because stringbuf deals std::string.

in essence want able (or similar):

mystringclass string myoutput << "hello" << string << "world" << std::endl; 

where myoutput can changed print anywhere want.

thank you.

not problem. define class, , within it's definition add ostream& operator<<(const string&);.

inside operator, can code whatever handling want (look @ std::string inspiration)


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -