Was watching the below youtube video and thought, "Oh don’t we use push_back
in stack_alloc
? Should we use emplace_back
(with move()
?)**
Bob used it in his continuation based autodiff post and mentioned it in the moving to C++11 post.
Looking at the stack_alloc code it looks like emplace_back
would be fine?
If no one has objections I can try it out and run the performance tests over it this week.
Note: idt what he is talking about in the video is 100% relevant, but it’s interesting and made me look at whether we were using push_back
or emplace_back
. It starts at the point that I thought was relevant.
**TL;DR for push_back
vs. emplace_back
is summarized here and essentially avoids a temporary copy when moving an object into a vector.