Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2002-09-25 06:44:53


Alexander Nasonov wrote:

> Addinionally, I would like to add convertion between
> dynamic_any<Sequence1> and dynamic_any<Sequence2>:
>
> template<class DynAny, class Sequence2>
> DynAny convert(dynamic_any<Sequence2> & val);
>
> dynamic_any<Sequence1> a1 = /* ... */;
> dynamic_any<Sequence2> a2 = convert<dynamic_any<Sequence2> >(a1);

Or may be extract can be used for convertions? Example:

  typedef dynamic_any< mpl::vector<dynamic_any_less> > less_comparable_any;

  less_comparable_any a1(0);
  int & ri = extract<int &>(a1); // extract reference to holded value
  dynamic_any<> a2 = extract<dynamic_any<> >(a1); // convert
  any a3 = extract<any>(a1); // convert to 'any'

  extract<any &>(a2); // compile error
  extract<const dynamic_any<> &>(a1); // compile error

--
Best regards,
Alexander Nasonov
e-mail account: alnsn
e-mail server:  mail.ru

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