Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-10-07 09:54:19


boost::any_cast<V>(a) has the following definition:

template<typename ValueType>
  ValueType any_cast(const any & operand);

Two questions.

* Why does the cast return by value?

* Should this:

boost::any a(4);

boost::any_cast<int const &>(a);

example work?

Motivation:

template<class R, class A> R invoke(R (*f)(A), any const & a)
{
    return f(any_cast<A>(a));
}

--
Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk