Re: [committed] libstdc++: Simplify variant access functions

2021-10-15 Thread Maciej Cencora via Gcc-patches
Hi, variant getter can be implemented in C++17 without using "recursive" calls, but by generating a list of member pointers and applying them with fold expression. Here's an example: https://godbolt.org/z/3vcKjWjPG Regards, Maciej

[committed] libstdc++: Simplify variant access functions

2021-10-14 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: * include/std/variant (__variant::__get(in_place_index_t, U&&)): Rename to __get_n and remove first argument. Replace pair of overloads with a single function using 'if constexpr'. (__variant::__get(Variant&&)): Adjust to use __get_n. Tested