Boost logo

Boost :

Subject: Re: [boost] [variant] address of a variant type from the address of its sub-object?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2016-04-14 10:30:49


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


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