std::矢量;无法转换参数;Visual Studio 2012
std::vector; cannot convert parameter; Visual Studio 2012
我在使用VS2012 x64 express版本时遇到错误。同样的代码在VS2010下也能正常工作。我已经在stackoverflow浏览了很多线程,它似乎是VS2012中的一个bug。
代码:
typedef vector< vector<cv::Point2d> > vec_type;
vec_type table;
table.assign( 100, 0 );
错误:
错误C2664:"
void std::vector<_Ty>::assign(unsigned __int64, const std::vector<cv::Point2d> &)
":无法将参数2从"int
"转换为"const std::vector<_Ty> &
"
请有人能指出这个问题的解决方案或解决方法吗?
感谢
vec_type
元素是vector<cv::Point2d>
类型,您不能将0
分配给它,解决方法可以是:
传递vector<Point2d>
默认构造函数
table.assign(100, vector<Point2d>());
或者使用std::vector::resize来获得相同的效果:
table.resize(100);
相关文章:
- Visual Studio 2015:Extern "C" 和 "export" 关键字
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- 试图在visual studio上用C++创建一个桌面应用程序
- 如何在MS Visual Studio 2019中运行QT UI
- 如何使用Visual Studio 2017在C++中为参数化对象数组使用唯一指针
- Visual Studio Code - C++ Debugger 無法啟動
- Visual Studio 2019:插入多个C++风格的单行注释
- Visual Studio Code "undefined reference to `WinMain@16'"
- Visual studio代码重构似乎不起作用(例如,重命名符号-f2)
- Visual Studio中的函数声明和函数定义问题
- 如何指定我希望我的LIB链接到的DLL文件?-Visual Studio 2019
- Visual Studio mkl_link_tool.exe链接错误
- Visual Studio(或任何其他工具)能否将地址解释为调用堆栈(boost上下文)的开头
- 不同的Visual Studio版本中缺少.dll
- 用Visual Studio在C++中嵌入Julia
- Visual Studio 2017循环自动向量化问题
- 有没有办法在远程设备上打开和编辑visual Studio 2017解决方案
- 尝试使用继承和模板实现CRTP.Visual Studio正在生成编译器错误
- Visual Studio在尝试读取resource.txt文件时崩溃
- Visual Studio 2017 不允许我创建 C++ 专用模板