Boost logo

Boost :

From: Mikhail Glushenkov (bbman_at_[hidden])
Date: 2004-12-08 15:25:35

Yuval Ronen <ronen_yuval <at>> writes:

> Hi,
> I've checked the 'any' library, and I have a suggestion.
> Wouldn't it be nicer if class any will have a member method like:
> template <typename T>
> T get() const;
> or maybe even:
> template <typename T>
> const T& get() const;
> template <typename T>
> T& get();

I proposed enhancing any_cast by adding support
for extracting reference to the held value some
time ago(and it was proposed in the past), but nobody
replied to that message. Looks like Boost.Any
maintainer's on the vacation.
Basic idea was to make this work
(now you have to use some obscure syntax):
T& object = any_cast<T&>(any_object);

Boost list run by bdawes at, gregod at, cpdaniel at, john at