Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emplace_back と push_back の違いに関する説明を修正 #85

Merged
merged 2 commits into from
Dec 9, 2020

Conversation

rinatz
Copy link
Owner

@rinatz rinatz commented Dec 7, 2020

Fix #72

`push_back` と同じかそれ以上のパフォーマンスを得られます。
多くの処理系では `push_back` を実装するのに `emplace_back` を呼び出していますから
現代において `push_back` を使うべき理由は存在しません。
C++11 より前は push_back という関数のみが末尾への要素追加を担っていました。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これってpush_backみたいにcode記法使わなくていいのでしたっけ?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あっ、確かに必要ですね。

@rinatz rinatz merged commit 61b2a6d into master Dec 9, 2020
@rinatz rinatz deleted the fix-issue-72 branch December 9, 2020 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3-5. vectorへのemplace_back/push_back説明への違和感
2 participants