visual-c++

What is the most efficient way to convert a std::vector<T> to a .NET List<U>?

≯℡__Kan透↙ 提交于 2020-07-05 02:39:09
问题 What is the most efficient way to convert a std::vector to a .NET List? To give some context, I am wrapping an unmanaged C++ class with C++/CLI. The C++/CLI class holds a pointer to the C++ class and I have a wrapper for each public method. One method returns a std::vector, so in my wrapper I was going to return the .NET class List. I.e. // unmanaged class class A { public: std::vector<int> runList(); } // managed class public ref class A { public: // the below is obviously extremely

What is the most efficient way to convert a std::vector<T> to a .NET List<U>?

我是研究僧i 提交于 2020-07-05 02:38:05
问题 What is the most efficient way to convert a std::vector to a .NET List? To give some context, I am wrapping an unmanaged C++ class with C++/CLI. The C++/CLI class holds a pointer to the C++ class and I have a wrapper for each public method. One method returns a std::vector, so in my wrapper I was going to return the .NET class List. I.e. // unmanaged class class A { public: std::vector<int> runList(); } // managed class public ref class A { public: // the below is obviously extremely

Can I get the limits of the stack in C / C++?

守給你的承諾、 提交于 2020-07-04 20:53:42
问题 My question is pretty simple and straightforward: if I have e.g. 1MB of RAM assigned to the program's stack, can I get the addresses of the start and the end, or the start and the length? I'm using Visual Studio 2013. 回答1: You should question your assumptions about stack layout. Maybe the stack doesn't have just one top and bottom Maybe it has no fixed bottom at all Clearly there's no portable way to query concepts which are not portable. From Visual C++, though, you can use the Win32 API,

Build QT Source with OpenSSL and MSVC2017

邮差的信 提交于 2020-06-28 06:21:15
问题 I managed to compile openssl-1.0.2o (using nasm-2.13.03) like shown here: https://wiki.qt.io/Building_Qt_Desktop_for_Windows_with_MSVC However trying to build the Qt-Source already fails when trying to configure using the following command (it works without ssl/openssl): C:/qt-everywhere-src-5.11.1/configure -platform win32-msvc2017 -prefix win32-msvc2017 -opensource -confirm-license -debug-and-release -force-debug-info -nomake examples -nomake tests -skip qtwebengine -skip qt3d -I C:\openssl

How to verify if the Spectre Mitigation flag used in Visual Studio 2017 works for C++?

柔情痞子 提交于 2020-06-28 04:15:06
问题 I want to see how the spectre mitigation flag solved a problem to convince my team that we need to add this flag to our large code base for upcoming projects. I am searching for sample projects that have a spectre vulnerability and is resolved by adding a spectre mitigation flag introduced last week in Visual Studio 2017. Can some one please help me in putting across a POC to demo to my larger team as to how the recently added support from Microsoft in Visual Studio overcomes the problem?

How to include libraries when compiling with Visual Studio on command line?

亡梦爱人 提交于 2020-06-27 08:46:10
问题 I'm attempting to build a program with Visual Studio 2008 on the command line. After reading Walkthrough: Compiling a Native C++ Program on the Command Line. I tried the following: Run the vcvaralls.bat to setup the enviroment: "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" Wrote this simple C++ application: #define _WIN32_WINNT 0x501 #include <windows.h> INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MessageBoxA(0,

Stack around the variable '…' was corrupted

徘徊边缘 提交于 2020-06-25 21:24:27
问题 On MSVC 15.8.5 in debug mode I get that Run-Time Check Failure #2 - Stack around the variable 'insert_into' was corrupted. Is there a bug in MSVC or have I done something bad? Runs fine on clang version 6.0.0-1ubuntu2 and clang version 7.0.0-svn341916-1~exp1~20180911115939.26 #include <set> template <typename... T> struct Overload : T... { //support struct for combining and overloading multiple lambdas using T::operator()...; }; template <typename... T> Overload(T...)->Overload<T...>; using

Stack around the variable '…' was corrupted

♀尐吖头ヾ 提交于 2020-06-25 21:23:11
问题 On MSVC 15.8.5 in debug mode I get that Run-Time Check Failure #2 - Stack around the variable 'insert_into' was corrupted. Is there a bug in MSVC or have I done something bad? Runs fine on clang version 6.0.0-1ubuntu2 and clang version 7.0.0-svn341916-1~exp1~20180911115939.26 #include <set> template <typename... T> struct Overload : T... { //support struct for combining and overloading multiple lambdas using T::operator()...; }; template <typename... T> Overload(T...)->Overload<T...>; using

C++ header files for UDP in Windows?

旧巷老猫 提交于 2020-06-24 12:34:09
问题 I have a linux applications which sends data over UDP protocol. It uses these header files: #include <stdio.h> /* standard C i/o facilities */ #include <stdlib.h> /* needed for atoi() */ #include <unistd.h> /* defines STDIN_FILENO, system calls,etc */ #include <sys/types.h> /* system data type definitions */ #include <sys/socket.h> /* socket specific definitions */ #include <netinet/in.h> /* INET constants and stuff */ #include <arpa/inet.h> /* IP address conversion stuff */ #include <netdb.h

Visual C++ dump preprocessor defines

筅森魡賤 提交于 2020-06-23 06:05:50
问题 I'm trying to find out all the preprocessor defines of the Visual C++ compiler (MSVC). I can do gcc -dM -E - < /dev/null on GCC to dump all the preprocessor defines. Do we have something similar with the Visual C++ compiler compiler? I'm using Visual C++ 9.0. 回答1: There is no such command. However, MSDN (both online and offline) lists all the preprocessor defines, both Microsoft specific, standard defined and ANSI defines. 来源: https://stackoverflow.com/questions/4640267/visual-c-dump