[Development] How to make a fancy QMap c++17 initializer_list

Ville Voutilainen ville.voutilainen at gmail.com
Wed Jul 26 07:36:42 CEST 2017


On 26 July 2017 at 01:33, Thiago Macieira <thiago.macieira at intel.com> wrote:
> On terça-feira, 25 de julho de 2017 15:03:17 PDT Marc Mutz wrote:
>> A nested brace initializer does not have a type, if the types used in
>> the inner braces are distinct, so
>>
>>     std::map m = {{k1, v1}, {k2, v2}};
>>
>> will not work, even if the compiler implements the DR that you find
>> referenced from the cppreference link Henry posted. AFAIU, this would
>> need more language support than what we find in C++17. Ville can
>> probably tell if there are proposals on the table to enable this.
>
> Even with the deduction guide?


Even with the guide. See https://wandbox.org/permlink/qH4LrE4EfEQ5C6hU
and experiment with what happens when the mention of pair is removed.
The end result is not very nice, and I am not aware of any proposals to fix it.



More information about the Development mailing list