From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2003-02-13 04:13:32
The following is a sketch of a potential use case for the newly-accepted and
already very useful 'optional' class.
Suppose you have a pure RAII guard/locker which unconditionally does its
and you want to write a semantic equivalent to the following
boost::scoped_ptr<RAII_lock> lock( cond ? new RAII_lock(entity) : 0 );
expect for the dynamic allocation part. How would you do it?
IMO the following seems only natural:
boost::optional<RAII_lock> lock( cond, entity );
The only problem with the above is that currently you cannot write something
like this. It would be nice if we could, IMO.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk