From: Andy Little (andy_at_[hidden])
Date: 2003-11-08 10:42:32
"Andy Little" <andy_at_[hidden]> wrote in message
> "Oleg Grunin" <ogrunin_at_[hidden]> wrote in message
> > It's kind of sad that boost::variant lacks implicit conversion to each
> > of its bound types. I think, convience and symmetry calls for the syntax
> > like this:
> [snipped more refined example, which proposes compiler error on incorrect
> cast...nice and a great improvement on my code!]
> Yup !
> Heres some code I worked on a couple of years ago. Its certainly Not
> presented as an example of good style, or a good solution
> but of the need for what Oleg is proposing
> I called it an E_ptr but its a Variant, except types are hard coded
> Point is that I (theoretically should!) always check what type is in
> before extracting. (hmm .... thats because its a Variant :-) )
> In use you use the E_ptrs operator()() to find out what type you have in
> I would certainly prefer to catch typos at compile time !
Ooops ... but if I could do that I wouldnt need a Variant ... Sorry !
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk