Boost logo

Boost :

Subject: Re: [boost] [review] string convert
From: Vladimir Batov (vbatov_at_[hidden])
Date: 2011-05-10 17:48:41

> Vicente BOTET <vicente.botet <at>> writes:
> ...
> I suspect you have not understood my concern. The question is what is the
> default behavior of the conversion
> of two UDT Source and Target if the library is not aware of.
> Is it
> return Target(val)
> or
> Target res;
> ios << val;
> ios >> res;
> return res;
> ?
> IMO this difference in behavior merits two different functions.

The second approach of converting two UDTs (which could be done with
lexical_cast) never made sense to me. It still looks bizarre and I doubt anyone
deployed it ever. lexical_cast stream-related business is sensible as long as
the string type is in the picture. In fact, I do not believe the ios-based
conversion of 2 UDTs is by design. I see it more of a side-effect of
lexical_cast stream-based approach to to_string from-string conversions. After
all, it's not called *lexical* for nothing. The original 'convert' did not have
the second behavior... well, it did not have the first -- Target(val) -- either.
:-) That generalization seems sensible.


Boost list run by bdawes at, gregod at, cpdaniel at, john at