push_back vs emplace_back

后端 未结 7 2379
南旧
南旧 2020-11-22 03:41

I\'m a bit confused regarding the difference between push_back and emplace_back.

void emplace_back(Type&& _Val);
void push_         


        
7条回答
  •  时光取名叫无心
    2020-11-22 03:49

    A nice code for the push_back and emplace_back is shown here.

    http://en.cppreference.com/w/cpp/container/vector/emplace_back

    You can see the move operation on push_back and not on emplace_back.

提交回复
热议问题