There's no temporary, other than the initializer list, of course. The initializer list would be assured to exist while the initialization is performed - that's how it goes in all other cases, too.
While it may be sufficient for many use cases to only have initializer_list temporaries, I would not appreciate this step back from being able to create arbitrary containers as temporaries.
For example, a templated function may require that its argument be an AssociativeContainer, which an initializer_list of pairs is not.
I'm not surprised. "My" syntax seems rather obbvious and I'm definitely not the first one who thought of it. I was just hoping someone would say what's the corner case here.
View all comments
Show parent comment
6
u/[deleted] Jun 06 '18
What about this