Boost logo

Boost :

From: brass goowy (brass_at_[hidden])
Date: 2008-05-26 18:45:20


Scott Woods writes: >I looked through the thread at "for each member of a sturcture/class ?" and >not >sure how to respond; the issue being dealt with in that thread (while >interesting) is >subordinate to my goals. >I do not have any magic technique for avoiding duplication of member >information. Any C++ type that wishes to play within my library >must define the following two global operators; >inline network_variant & >operator<<( network_variant &nv, const person &p ) >{ >network_memory::iterator i = network_output<3>()( nv ); >*i++ << p.name; >*i++ << p.score; >*i++ << p.team; >return nv; >} >inline person & >operator>>( network_variant &nv, person &p ) >{ >network_memory::iterator i = network_input<3>()( nv ); >*i++ >> p.name; >*i++ >> p.score; >*i++ >> p.team; >return p; >} >My library for persistence, thread communication and network messaging >deals with the movement and representation of "network_variants", i.e. >by providing transform functions as above, the type acquires persistence, >transfer-between-threads and transfer-across-networks capabilities, in >one hit. It would have been good to include those in your original post. When you said, "But actually this is precisely the most compelling thing about the library - it reduces code that traditionally can be quite difficult into fragments such as those shown," I wondered if that meant you had developed an alternative approach. It isn't clear to me how what you have is better than what is already in Boost. From what you've said I guess it is more flexible, but it isn't obvious to me how. You could also consider integration with http://s11n.net. Regards, Brian Wood Ebenezer Enterprises www.webEbenezer.net


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk