gpt4 book ai didi

c++ - std::string::clear 和 std::list::clear 是否从内存中删除数据

转载 作者:可可西里 更新时间:2023-11-01 16:27:39 28 4
gpt4 key购买 nike

在 string::clear 函数的描述中,它说:

clear: Erases the contents of the string, which becomes an empty string (with a length of 0 characters).

在 list::clear 函数的描述中,它说:

clear: Removes all elements from the list container (which are destroyed), and leaving the container with a size of 0.

清除是覆盖字符串和列表的内存还是只是释放它们?

最佳答案

这两个函数都不需要覆盖已删除的数据。

关于c++ - std::string::clear 和 std::list::clear 是否从内存中删除数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17579588/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com