3 ms·
The reason I find myself preferring push_back is that I can use aggregate init with it. Which is usually preferable to the uglier but faster emplace_back in pla
by bun_terminator 2y ago
The reason I find myself preferring push_back is that I can use aggregate init with it. Which is usually preferable to the uglier but faster emplace_back in places where it doesn't matter.
- quuxplusone 2y agoYou're doing the right thing. But it might be interesting to note that since C++20, emplace_back can also (kinda-sorta) involve aggregate initialization: https://quuxplusone.github.io/blog/2022/06/03/aggregate-parens-init-considered-kinda-bad/ https://quuxplusone.github.io/blog/2022/06/03/aggregate-pare...
- bun_terminator 2y agoI meant designated init in hindsight