|
Boost : |
Subject: Re: [boost] [function] Placement new warnings from gcc 6
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2016-04-03 16:36:43
On 2016-04-03 14:39, Larry Evans wrote:
> On 04/02/2016 08:08 AM, Andrey Semashev wrote:
> [snip]
>> union function_buffer
>> {
>> mutable function_buffer_members m;
>> mutable char data[sizeof(function_buffer_members)];
>> };
>>
>> This would require more modifications to the code though.
>>
>> (Sigh... if only we could inherit unions...)
>>
>
> Could you provide an example of how you'd like to inherit unions?
> I'm guessing:
>
> union function_buffer
> : supertype_1
> , supertype_2
> ...
> , supertype_N
> {
> };
>
> where all of the supertype_I's would occupy the same storage?
Yes. More precisely, all supertype_I's and function_buffer's members
would map to the same storage, and supertype_I's members would be
syntactically addressed as if those were members of function_buffer
(i.e. similarly how it is with structs and classes).
The above function_buffer definition could be written as:
union function_buffer : public function_buffer_base
{
mutable char data[sizeof(function_buffer_base)];
};
and members of function_buffer and function_buffer_base could be
addressed similarly:
function_buffer fb;
fb.obj_ptr = ...;
fb.data = ...;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk