c++ string.assign
时间: 2023-08-19 14:05:37 浏览: 113
在C++的string库中,assign函数用于将一个字符串赋值给另一个字符串。它的定义如下:
```cpp
basic_string& assign(const basic_string& __str)
```
该函数接受一个常量引用参数__str,将__str的值赋给当前字符串,并返回当前字符串的引用。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [C++string中的assign()、erase()、swap()函数](https://download.csdn.net/download/weixin_38599231/14885010)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [c++中string的assign方法使用](https://blog.csdn.net/zqw_yaomin/article/details/81281235)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文