visual-c++专题提供visual-c++的最新资讯内容,帮你更好的了解visual-c++。
在查看关于SO( Using NaN in C++)的另一个问题后,我对std :: numeric_limits< double> :: signaling_NaN()感到好奇. 我无法获得signaling_NaN抛出异常.我想也许通过发信号它真的意味着一个信号,所以我尝试捕捉SIGFPE但不是…… 这是我的代码: double my_nan = numeric_limits<double>:
我是Visual C中使用Graphics的新手.我只是想制作一个充满颜色的矩形.需要帮助来纠正这个…… RECT rect; HDC hdc; hdc=CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL); rect.left=30; rect.right=100; rect.top=50; rect.bottom=200; FillRect(hdc,&rect,(H
例如: class Example { public: explicit Example(int n) : num(n) {} void addAndPrint(vector<int>& v) const { for_each(v.begin(), v.end(), [num](int n) { cout << num + n << " "; });
参见英文答案 > constexpr not working if the function is declared inside class scope                                    3个 为什么以下C代码无法用VC2017编译? struct FixedMatchResults { static constexpr std::size_t cou
我正在尝试获取一个 Windows :: Devices :: Usb :: UsbDevice对象,引用我拥有的特定USB设备,以便将其传递给第三方插件.由于项目限制,我无法使用C/C++X扩展. 在查看了无数的线程,答案和引用之后,我想出了一个初始实现,它可以在我需要的WinRT类上调用静态方法.唯一的问题是,即使没有调用导致HRESULT失败,最后一次调用FromIdAsync也不起作用,因
MS Visual C 2015 Update 1 implements the Modules proposal. 以下是它的工作原理示例: 资料来源: // c.ixx | // b.ixx | // a.cpp module GM; | import GM; | impor
我尝试这样的东西(没有编译): struct mystruct { somestruct arr[4]; mystruct(somestruct val) : arr[0](val), arr[1](val), arr[2](val), arr[3](val) {} }; 如何在c中做得最好? 注意:我可能想要使用此方法仅设置一些数组元素. 在C 11中,如果要设置所有元素: my
Visual Studio 2015更新3改进了对C 11的支持,但我有一个奇怪的问题,我正在寻找解决方法. 当使用MSVC为模板类型参数(“完全定义的类型”)编译可变参数模板代码时,一切都很好,但是如果我想使用模板模板参数(“部分定义的类型”),则结果变得不正确. #include <iostream> using namespace std; template <template<typen
我在C中构建一个客户端/服务器对,我使用winsock进行通信.但是,我无法在C中找到任何可以实现某些内容的库,而不是直接从客户端向服务器发送请求,而是存储请求,稍后将与服务器通信. 有没有任何方法或库可以将请求发送到像经纪人这样的东西,反之亦然?将存储请求的东西,然后将与服务器通信.这些是我已经使用的库: #pragma comment( linker, "/defaultlib:ws2_32.
在C 11标准中,有一个关于支持统一初始化的阵列的说明,其中指出: The implementation is free to allocate the array in read-only memory if an explicit array with the same initializer could be so allocated. GCC/C++lang / VS会利用这个吗?或者使用
我有一些C代码: namespace Compute { class __declspec(dllexport) IProgressCB { public: virtual void progress(int percentCompleted) = 0; }; double __declspec(dllexport) compute(IProgressCB *progre
我正在尝试编写一个模板函数,它将汇总某些集合的所有元素 – 指定为普通的stl容器,或指定为range-v3的范围. (实际的功能,如下所示更通用)我认为这样可行: template <typename Range, typename Ret, typename Func> std::pair<Ret, int> sum(const Range& range, Ret zero, Func ext
我正在使用的游戏引擎在调试版本中速度太慢,无法调试游戏.我想要的一件事是编译器内联小函数(特别是在Vector / Matrix和容器类中).这可能会或可能不会加快调试构建中的游戏速度.在大量剖析并试图找出瓶颈之前,我想我会首先尝试这个,因为我必须做最小的工作,结果可能很有希望. 那么,有没有办法让Visual C编译器在调试版本中内联函数? 项目选项 – > C/C++ – >优化 – >内联函
在处理我自己的类型擦除迭代器时,我遇到了一个问题,编译器(MSVC10)在此代码上发生了堆栈溢出崩溃: struct base {}; //In actual code, this is a template struct that holds data template<class category, class valuetype> struct any; //In actua
我无法弄清楚为什么Visual C无法自动矢量化这个循环…任何想法? 我明白了: testvec.cpp:12: info C5002: loop not vectorized due to reason '1200' 原因代码1200是: Loop contains loop-carried data dependences that prevent vectorization. Differe
如何将Visual C(2010)控制台应用程序与由MinGW(* .a格式)创建的STATIC库链接?它与Visual C 2010兼容吗? 谢谢. 它不兼容. 但是,如果从库中提取所有目标文件(使用ar),VC链接器就可以处理这些(我测试了它,虽然我使用了cygwin gcc而不是mingw gcc).请注意,如果不使用extern“C”,可能仍会出现名称错位问题. 您当然可以使用VC的LIB
请考虑以下简单示例 #include <string> #include <sstream> #include <iomanip> using namespace std; int main() { string str = "string"; istringstream is(str); is >> setw(6) >> str; return is.eof(); } 乍一看
#include "stdafx.h" #include <windows.h> #include <stdio.h> #include <iostream> #include <dos.h> using namespace std; class Dir { public: char* cat; Dir() { cout << "(C:/*)\n";
我在VS2013有一个C项目.在过去的类似项目中,我使用SubWCRev和Subversion来自动生成版本号.我有一个这样的模板文件: #define MAJOR_VERSION 2 #define MINOR_VERSION 2 #define MICRO_VERSION 0 #define BUILD_VERSION $WCMODS?$WCRE
我发现嵌套的lambda表达式编译和生成巨大的.obj文件非常慢.例如,在我的计算机上,以下代码生成一个大小为4766 KB的obj文件: int main() { auto f = [] { auto f = [] { auto f = [] { auto f = [] { auto f = []