|
Boost Users : |
From: Delfin Rojas (drojas_at_[hidden])
Date: 2006-02-13 14:08:30
Marc Mutz wrote:
<snip>
>
> I was wondering why any_cast doesn't return a reference (as
> boost::get does for boost::variant). To me, it seems to make
> little sense to supply a any_cast overload with argument any&
> in addition to const any &, for return-by-value. It also
> needlessly invokes T's copy ctor, which esp bad if that one throws.
>
<snip>
According to the documentation of boost::any_cast<T>, "if T is a reference
to (possibly const qualified) ValueType, it [boost::any_cast] returns a
reference to the held value."
-delfin
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net