我有一个 vector
static std::vector<std::pair<int,std::string> > m_Data;
我想在填充新值之前清除内容,
这是正确的方法吗?
m_Data.clear().
如何称呼这样的 vector ?对 vector ?
最佳答案
是的。但您可以在清除 vector 之前清除您的配对。绝对确定您拥有像 valgrind 这样的工具。
std::vector::clear Clear content Removes all elements from the vector (which are destroyed), leaving the container with a size of 0.
关于c++ - 在 C++ 中清除对 vector ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28765811/