|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-08-30 13:16:18
On Thursday 30 August 2001 01:14, you wrote:
> In the case of optional, it makes complete sense to provide only a default
> constructor, because if you could initialize x with something you shouldn't
> be using optional in the first place; that is, it is completely senseless
> to write optional<T> x = T(...);
I disagree with this.
optional<T> foo() {
if (everything_is_happy_in_the_world) {
return optional<T>(some_value);
}
else {
return optional<T>();
}
}
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk