Boost logo

Boost :

Subject: Re: [boost] [review] string convert
From: Jeremy Maitin-Shepard (jeremy_at_[hidden])
Date: 2011-05-05 21:58:59


On 05/05/2011 05:57 PM, Vladimir Batov wrote:
>> Vicente BOTET<vicente.botet<at> wanadoo.fr> writes:
>> ..
>> I suspect that these complex classes you are talking off don't define the
>> input/ouput stream operator to work with your conversion framework.
>
> Jeez, is it really that hard to accept that 'convert' works and is used with
> many classes complex or not. Say, a Train class is complex as it has a *lot* of
> stuff. We serialize/unserialize the class to/from XML using 'convert'. Train has
> op>>() op<<().

I don't like default_value as a customization point either. However, it
seems that for a non-default constructable type, operator>> is likely
not the ideal interface for unserialization. How would you use your
unserialization functionality separately from the convert library?
Presumably you would need some way to obtain a constructed instance in a
form suitable for invoking operator>>. If the non-default-constructable
type has any members that aren't default constructable, you would have
to somehow construct the members as well.


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