|
Boost Users : |
Subject: Re: [Boost-users] mpi: sending/receiving different types
From: Riccardo Murri (riccardo.murri_at_[hidden])
Date: 2010-12-09 09:01:58
Hi Hicham,
On Thu, Dec 9, 2010 at 2:47 PM, Hicham Mouline <hicham_at_[hidden]> 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
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