Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-02-12 13:44:41


From: "Darin Adler" <darin_at_[hidden]>
> On 2/12/02 10:26 AM, "Peter Dimov" <pdimov_at_[hidden]> wrote:
>
> > Ah, but that's a feature. You think that 0 is better? Use get(). Someone
> > else feels that an exception is better? Use the constructor.
>
> But this is not a good interface for the feature.

Perhaps. Do you have a better interface in mind?

> There's nothing to help you remember which version allows 0 and which
> doesn't. It could just as easily be the constructor which allows 0 and the
> get() function which throws an exception.

Very subjective area. The interface feels right to me, although I know that
many would disagree. I'm used to constructors throwing exceptions when they
for some reason can't construct the object; query functions, on the other
hand, especially something named get(), rarely throw.

> I stand by my original comment -- the constructor should not throw an
> exception.

Why?


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