Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2005-03-08 12:56:08


"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:00f501c52404$bff4fca0$6501a8c0_at_pdimov...
> Gennadiy Rozental wrote:
> > I believe this version is much less intuitive. optional<T> v is still
> > value of type T which may or may not be present. Accordingly when we
> > print it we print the value if it present or print nothing if it not.
>
> This isn't very useful. The output cannot be read back, and when printing
a
> sequence of optionals much of the information is lost.

1. This is not exactly true

Output most probably will look like:

a, , v, c, d, ,

Which should be enough to restore it back

2. Why should I bother at all?

In my opinion "able to restore" is not primary concern for output operators.
I know numerous cases where result of operator<< couldn't be read back.
Serialization of optional<T> does need to care about that.

Gennadiy


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