[committed] libstdc++: Add __maybe_const_t and __maybe_empty_t aliases
Jonathan Wakely
jwakely@redhat.com
Mon Mar 2 17:14:00 GMT 2020
On 02/03/20 09:33 +0100, Pilar Latiesa wrote:
>> It would be possible to implement those range adaptors so that the two
>> base subobjects could be at the same address, and so sizeof(Wtf) would
>> be smaller.
>
>Would:
> template<bool _Present, typename _Tp, typename _Empty = decltype([]{})>
> using __maybe_present_t = std::conditional_t<_Present, _Tp, _Empty>;
>work?
>
>It appears to work, but I'm not sure this is allowed by [temp.res/8.5].
Hmm, I'm not sure either, but I don't think I like it anyway :-)
I committed the patch that just renames it to __maybe_present_t. As I
said, I don't think the case of having two subobjects of the _Empty
type is likely in practice, and it wouldn't cause incorrect behaviour
anyway, just a small increase in size.
More information about the Libstdc++
mailing list