
9 Dec
2010
9 Dec
'10
2:01 p.m.
Hi Hicham, On Thu, Dec 9, 2010 at 2:47 PM, Hicham Mouline <hicham@mouline.org> wrote:
The bit I am missing now is my question here:
http://lists.boost.org/boost-users/2010/12/64797.php
I don't know how to assign the most derived type to the variant at creation in the sender. In your code snippet, you explicitly construct c, then assign it to v. For me, I get given const Base& and I need to store the actual type.
If all you have is a `const Base&` then slicing has already happened and there's no way to get the original type: all you have is a base instance. Can't you change your code to pass around `boost::variant<Base<Derived,...>` or some other form of discriminated union? Best regards, Riccardo