$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: David Abrahams (dave_at_[hidden])
Date: 2005-07-15 20:31:59
"Calum Grant" <calum_at_[hidden]> writes:
> I've been following this dual_state vs optional discussion for a while.
> It seems to me that one should really have a policy class that defines
> the default behaviour when the value is unassigned. This policy should
> define whether to
>
> - throw an exception
> - construct an object on the fly
> - return a default
> - return a null pointer
> - whether to return by value or by reference
>
> A second point, can't all this be achieved by adding policies to smart
> pointers?
Whoa; smart pointers and boost::optional are not very closely related
beasts. If you add enough policies to std::list you could probably
handle this use case, too. I don't think finding something to
policy-ize is always the best way to fit new designs into an existing
framework.
-- Dave Abrahams Boost Consulting www.boost-consulting.com