I have an Image class which has the following implementation
friend std::ostream& operator << ( std::ostream &os,Image* &img); So I can serialize it by calling
ostm << img; // which will write an string into the ostream. Is it possible to get that string out of the ostream or serialize it directly into an string object?
Thanks!
The solutions worked like a charm. Thank you so much!
Image* &img? For output aconst Image&would be more conventional.operator<<without being able to see its implementation.const Image&as the second parameter tooperator<<? The code you have posted looks very suspect. Typically anop<<shouldn't have to create or modify objects being output. What's the definition ofImage, the constructor that you are using andcvSaveImage?std::ostringstreamwould cause a memory error unless you're feeding it masses of data. Can you show the definition ofImage?