streaming redux

Sean Kelly sean at invisibleduck.org
Tue Dec 28 15:58:40 PST 2010


Michel Fortin Wrote:

> On 2010-12-28 17:19:01 -0500, Sean Kelly <sean at invisibleduck.org> said:
> > 
> > And I guess writeTo could just call formatter.write(MyClass c).  You're 
> > right, that works.
> 
> Well, not exactly. I'd expect formatter.write(Object) do be the one 
> calling writeTo.
...
> A typical writeTo might look like this:
> 
> 	void writeTo(Formatter formatter) {
> 		formatter.write(member1);
> 		formatter.write(member2);
> 	}

This is what I meant.  Sorry for the confusion.

> The only thing is that you need to define 
> writeTo (or use the mixin) with any class and subclass you want to 
> serialize.

Similar to what I did in C++ then.  Gotcha.


More information about the Digitalmars-d mailing list