Boost logo

Boost Users :

Subject: Re: [Boost-users] variant over base and derived classes
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-12-09 09:15:45


>-----Original Message-----
>From: "Diederick C. Niehorster" [dcnieho_at_[hidden]]
>Date: 09/12/2010 01:51 PM
>To: boost-users_at_[hidden]
>Subject: Re: [Boost-users] variant over base and derived classes

>(sorry if this is a top post, my phone shows no msg quotes)

>I'm no expert on this, but isn't there an compile time function to
>testing if an instance is derived from another (in introspection or
>something)? You could then maybe sort the variant types for most to
>least derived and then test untill you find the suitable cast?

>Just brainstorming pretty much. Hope its useful!
>Best,
>Dee

yes, there is boost::is_base_of or some metafct like that in type_traits.
not quite sure how to implement the sort though?
will checkout mpl::sort with binary predicate base_or_derived.
I have under 10 types, so compile time should be ok
thanks,


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net