This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Implement std::experimental::variant


On 6 August 2016 at 08:45, Tim Shen <timshen@google.com> wrote:
>>  using namespace std;
>>  constexpr variant<literal, nonliteral> v{};
>>  constexpr variant<literal, nonliteral> v1{in_place_type<literal>};
>>  constexpr variant<literal, nonliteral> v2{in_place_index<0>};
>
> Good news! This compiles now! I learned the technique from Anthony
> Williams's implementation, whose code also compiles, but it requires a
> close-to-trunk gcc, which implements
> "...for unions, at least one non-static data member is of non-volatile
> literal type, ...".
>
> Also added it as a test.
>
> Please verify the implementation by looking at _Uninitialized and
> _Variant_storage.


Sounds very promising, I'll try to play with it before the end of the
weekend. Jonathan will be on holiday
next week so we have time before this gets committed. We might want to
entertain the idea of running
the tests at https://github.com/efcs/libcxx/tree/variant although that
implementation isn't something we should
adopt things from.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]