|
Boost : |
From: Jeff Garland (jeff_at_[hidden])
Date: 2000-11-09 08:04:40
> Unfortunately this would not be wise: Although it clearly throws
> bad_any_cast in the event of a failed conversion, it might also throw on
> copy construction of the result -- we cannot know in advance of time
> what it might throw (eg std::string could throw bad_alloc and foo could
> throw bar).
Agreed. I keep wanting to use throw specifications to document exceptions
for users, but the ugly unexpected foils it again :(
>
> >2) A section on performance in the documentation. You hint at
> this in the
> >write-up, but some explicit notes would be nice.
>
> Not even sure I hint at it! Yes, a brief mention of complexities and
> memory usage wouldn't go amiss.
In particular, I was thinking about copying. You mention that this is
intended for "ValueTypes" and describe when copies are made. In something I
was doing I made a "multi-valued any" with a std::vector<boost::any> and put
it into a map of any's. It works great, and I know I can afford the copies,
but this wouldn't scale forever....
> >Here's a rather obvious alternative to your property example....
>declarative property example I currently have. However, I will drop the
>explicit conversions.
Yes...that makes it cleaner :)
Jeff
jeff_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk