gpt4 book ai didi

c++ - 为什么字符串中的最后一个符号在 'std::remove' 之后加倍?

转载 作者:行者123 更新时间:2023-11-27 22:32:21 24 4
gpt4 key购买 nike

<分区>

我想从字符串中删除一个符号“:”。

std::cout << str << " "; //1948: 59 63
std::remove(str.begin(), str.end(), ':');
std::cout << str << " ";//1948 59 633

如果我将范围更改为 [str.negin(), str.begin()+5) 一切正常。

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