Tag: visual studio 2010

为什么将0.1f改为0会使性能下降10倍?

为什么这一点代码, const float x[16] = { 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6}; const float z[16] = {1.123, 1.234, 1.345, 156.467, 1.578, 1.689, 1.790, 1.812, 1.923, 2.034, 2.145, 2.256, 2.367, 2.478, 2.589, 2.690}; float y[16]; for (int i = 0; i < 16; i++) { y[i] […]

为Visual Studio 2010安装OpenCV-2.3

我试图用Visual Studio 2010 Express使用opencv 2.3。 我的代码是从例子: #include "stdafx.h" #include <highgui.h> int _tmain(int argc, _TCHAR* argv[]) { int c; // allocate memory for an image IplImage *img; // capture from video device #1 CvCapture* capture = cvCaptureFromCAM(1); // create a window to display the images cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE); // position the window cvMoveWindow("mainWin", 5, 5); while(1) { […]

Visual Studio中“stdafx.h”的用法是什么?

当我在VS2010中启动一个项目时,stdafx.h自动生成。 我需要做跨平台的C ++库,所以我不/不能使用这个头文件。 这个是来做什么的? 我可以删除这个头文件吗?

是否需要知道T的完整定义的std :: unique_ptr <T>?

我有一些代码,如下所示: #include <memory> class Thing; class MyClass { std::unique_ptr< Thing > my_thing; }; 如果我将这个头文件包含在一个不包含Thing类型定义的cpp中,那么这个不会在VS2010-SP1下编译: 1> C:\ Program Files(x86)\ Microsoft Visual Studio 10.0 \ VC \ include \ memory(2067):error C2027:使用未定义的类型'Thing' 用std::unique_ptr std::shared_ptr替换std::unique_ptr并编译。 所以,我猜测这是当前VS2010 std::unique_ptr的实现,需要完整的定义,而且完全依赖于实现。 还是呢? 有没有什么标准的要求,使std::unique_ptr的实现不可能只与前向声明一起工作? 这感觉很奇怪,因为它只应该指向Thing ,不是吗?