2 ms·
It does, actually. In fact, this is the most concise one (see godbolt link): data.push_back({1, 2.0}); That does not work with emplace_back (not that it w
by MauranKilom 6y ago
It does, actually. In fact, this is the most concise one (see godbolt link):
data.push_back({1, 2.0});
That does not work with emplace_back (not that it would be useful) because the template arguments can't be deduced from the initializer list (whereas for push_back the type is known so you can initialize it with the initializer list).
- Koshkin 6y agoYou are correct, the problem is exclusively with emplace_back; incidentally, there is an "official" discussion of this at https://cplusplus.github.io/LWG/issue2089 https://cplusplus.github.io/LWG/issue2089.