node_vec为vector
若写为
for ( int j = 1; j< node_vec.size(); j++)
{
node_vec[j - 1]->next = node_vec[j];
}
也会运行得到正确的结果,但会有warning:
warning C4018: “<”: 有符号/
这是由于C++中vector的size()为unsigned int类型。
应该写为:
for (unsigned int j = 1; j< node_vec.size(); j++)
{
node_vec[j - 1]->next = node_vec[j];
}
来源:CSDN
作者:Gianna K
链接:https://blog.csdn.net/weixin_44208324/article/details/104555673