.push_back(
时间: 2024-05-18 17:14:01 浏览: 67
在顺序容器中添加元素的操作-iso 7637-3:2007(2)
.push_back()是一个在vector(向量)中添加元素的方法。它将一个元素添加到vector的末尾。可以将要添加的元素作为参数传递给.push_back()方法。例如,如果我们有一个int类型的vector,我们可以使用vec.push_back(10)将整数10添加到vector的末尾。同样,如果我们有一个string类型的变量str,我们可以使用str.push_back('d')将字符'd'添加到字符串的末尾。这个方法对于在vector或字符串的末尾添加元素非常有用。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [C++中push_back()函数](https://blog.csdn.net/snowcatvia/article/details/96716344)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [push_back()函数的用法](https://blog.csdn.net/mxh3600/article/details/129256563)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文