代码:
std::map<int,int> bad blocks;
bad_blocks.clear();
bad_blocks.insert(std::map::value_type(1,50);
报错:C2955 “std::map” use of class template requires template argument list
这个怎么解决?谢谢!
std::map<int,int> bad blocks;
bad_blocks.clear();
bad_blocks.insert(std::map::value_type(1,50);
报错:C2955 “std::map” use of class template requires template argument list
这个怎么解决?谢谢!
解决方案
40
std::map<int,int> bad_blocks; bad_blocks.clear(); bad_blocks.insert(std::map<int,int>::value_type(1,50));
40
或
std::map<int,int> bad_blocks; bad_blocks.clear(); bad_blocks.insert(std::make_pair(1,50));
 
                    


![[小白求帮助]分配的内存什么时候需要手动释放](https://www.codebye.com/wp-content/themes/douth/timthumb.php?src=https://www.codebye.com/wp-content/themes/douth/assets/img/pic/2.jpg&h=110&w=185&q=90&zc=1&ct=1)