|
Boost : |
Subject: Re: [boost] Another variant type (was: [peer review queue tardiness] [was Cleaning out the Boost review queue] Review Queue mem
From: Larry Evans (cppljevans_at_[hidden])
Date: 2015-04-13 16:48:04
On 04/04/2015 07:55 PM, Eric Niebler wrote:
> On 4/4/2015 4:42 PM, Larry Evans wrote:
>> On 04/04/2015 06:25 PM, Steven Watanabe wrote:
>>> AMDG
>>>
>>> On 04/04/2015 05:20 PM, Larry Evans wrote:
>>>> On 04/04/2015 06:18 PM, Steven Watanabe wrote:
>>>>> The reason that aligned storage doesn't work has nothing to
>>>>> do with calculating the alignment.
>>>>
>>>> Why does using aligned_storage not work, please?
>>>>
>>>
>>> On 04/04/2015 04:06 PM, Matt Calabrese wrote:
>>>> You need to use a recursive union if you are to get some
>>>> constexpr support.
>>>
>> OK. So Matt, could you please elaborate on why constexpr support
>> requires a recursive union?
>
> To put an object into aligned storage requires placement new, which is
> not constexpr. Using a recursive union avoids the need for placement new.
>
Thanks again, Eric.
However, the range-v3 variant get member function here:
https://github.com/ericniebler/range-v3/blob/master/include/range/v3/utility/variant.hpp#L581
is not a constexpr function, so why isn't
std::aligned_union<Ts...> for the data storage and a bunch
of placement news for construction, and reinterpret casts
for the get member function used instead of the recursive
union, located here:
https://github.com/ericniebler/range-v3/blob/master/include/range/v3/utility/variant.hpp#L91
?
-regards,
Larry
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk