Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-06-29 15:30:13


----- Original Message -----
From: "Miki Jovanovic" <miki_at_[hidden]>

> I am not overly fond of pairs, but std does this on several
> occasions. How about the non-throwing lexical_cast to return a
> pair<Targer,bool> ?

It's a nice idea. I much prefer value/functional semantics over out
parameters.

My biggest problem with pairs is the memnonic value of the members first and
second (almost nil in situations like this). 2 opposing arguments:
1. we should return
struct lexical_cast_result<T> {
   T value;
   bool succeeded;
}

for clarity. We'd have to provide conversions so that tie() would still
work.

2. We should use the precedent set by pair<iterator, bool> to say that
everyone will remember that the 2nd element indicates success.

-Dave


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