|
Boost : |
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2006-04-24 11:49:39
John Maddock wrote:
>boost::optional opt = mymap["fee"]["far"]["thumb"];
>
>would never throw, and
>
>
In fact, it wouldn't even compile, because optional is a template. But I
get what you mean, and I like it.
boost::optional<int> opt = mymap["fee"]["far"];
throws if fee/far exists and is not convertible to int, returns none if
fee/far does not exist, returns the converted value if it exists and is
convertible.
Sebastian Redl
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk