Boost logo

Boost :

Subject: Re: [boost] [variant] address of a variant type from the address of its sub-object?
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2016-04-15 04:12:07


2016-04-14 16:30 GMT+02:00 Steven Watanabe <watanabesj_at_[hidden]>:

> AMDG
>
> On 04/14/2016 12:39 AM, Andrzej Krzemienski wrote:
> > Hi,
> > Is there a portable way (guaranteed by the interface) to do the
> following?
> >
> > I have an object 'ob' of type Ob and know its address. I know it is an
> > active sub-object of a variant type, where Ob is one of the sub-types. Is
> > there a way to compute the address of the containing variant object?
> >
>
> No there isn't. It can't work in general because of
>
> http://www.boost.org/doc/html/variant/design.html#variant.design.never-empty.heap-backup-solution
>
> In Christ,
> Steven Watanabe
>

Thanks. The case may be different for the TR's std::experimental::variant,
though. I will have to try it.

Regards,
&rzej


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