Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2003-11-08 10:42:32


"Andy Little" <andy_at_[hidden]> wrote in message
news:boiu7d$1cf$1_at_sea.gmane.org...
>
> "Oleg Grunin" <ogrunin_at_[hidden]> wrote in message
> news:boi6fh$id$1_at_sea.gmane.org...
> > 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
there
> before extracting. (hmm .... thats because its a Variant :-) )
> In use you use the E_ptrs operator()() to find out what type you have in
> there:
>
> I would certainly prefer to catch typos at compile time !

Ooops ... but if I could do that I wouldnt need a Variant ... Sorry !

Andy Little


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