gpt4 book ai didi

c++ - 移动内容后调用 vector.resize(0) 是否安全

转载 作者:可可西里 更新时间:2023-11-01 15:08:51 25 4
gpt4 key购买 nike

<分区>

换句话说就是下面的代码sound(defined behavior,portable,...)

   std::vector<int> vec(100,42);
std::vector<int> other = std::move(vec);
vec.resize(0);//is this sound

//using vec like an empty vector

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