visual-c++-2010

Visual C++ 2010, rvalue reference bug?

女生的网名这么多〃 提交于 2019-11-30 22:16:52
Is it a bug in Visual C++ 2010 or right behaviour? template<class T> T f(T const &r) { return r; } template<class T> T f(T &&r) { static_assert(false, "no way"); //< line # 10 return r; } int main() { int y = 4; f(y); //< line # 17 } I thought, the function f(T &&) should never be called but it's called with T = int &. The output: main.cpp(10): error C2338: no way main.cpp(17) : see reference to function template instantiation 'T f(T)' being compiled with [ T=int & ] Update 1 Do you know any C++x0 compiler as a reference? I've tried comeau online test-drive but could not compile r-value

OpenSSL: can't build in VC++ 2010

。_饼干妹妹 提交于 2019-11-30 06:55:43
I have downloaded the latest OpenSSL source package. I want to build it with VC++ 2010 x64. Following the instructions doesn't seem to work. Configure step looks fine, but then: C:\1>ms\do_win64a.bat C:\1>perl util\mkfiles.pl 1>MINFO C:\1>perl ms\uplink.pl win64a 1>ms\uptable.asm C:\1>ml64 -c -Foms\uptable.obj ms\uptable.asm Microsoft (R) Macro Assembler (x64) Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. Assembling: ms\uptable.asm C:\1>perl util\mk1mf.pl no-asm VC-WIN64A 1>ms\nt.mak no rule for crypto\md4 at util\mk1mf.pl line 907. C:\1>perl util\mk1mf.pl

C++0x Lambda overhead

回眸只為那壹抹淺笑 提交于 2019-11-30 02:58:49
Is there any overhead associated with using lambda expressions in C++0x (under VS2010)? I know that using function objects incurs overhead, but I'm referring to expressions that are passed to STL algorithms, for example. Does the compiler optimize the expression, eliminating what seems to appear like a function call? I started to really like lambda expressions, but I'm a bit concerned about the speed penalty. Thanks in advance! You "know" that function objects incur overhead? Perhaps you should recheck your facts. :) There is typically zero overhead to using a STL algorithm with a function

Errors in std::make_shared() when trying to make shared_ptr?

江枫思渺然 提交于 2019-11-29 14:14:49
(Using Visual Studio 2010) I'm trying to create a shared_ptr of an existing class in my project (class was written a decade before std::shared_ptr existed). This class takes a non-const pointer to another object, it's empty parameter constructor is private. class Foobar { public: Foobar(Baz* rBaz); private: Foobar(); } When I try to create a shared_ptr to it, things don't go well: Baz* myBaz = new Baz(); std::shared_ptr<Foobar> sharedFoo = std::make_shared<Foobar>(new Foobar(myBaz)); On VS2010, this gives me error C2664: 'Foobar::Foobar(const Foobar &)' : cannot convert parameter 1 from

How to get string with pattern from std::regex in VC++ 2010

自作多情 提交于 2019-11-29 13:15:59
Can I get the string with regular expression from std::regex ? Or should I save it somewhere else if I want to use it later? In boost you can do this: boost::regex reg("pattern"); string p = reg.str(); or use << operator cout << reg; will print pattern . but in std::regex there is no str() or operator<<. Should I save my string somewhere else or I just can't find it? In debugger I can see what's in std::regex . I just looked in N3225, section 28.4 (header <regex> synopsis) and indeed, the basic_regex template has no member function str , and there are no operator<< provided. The paragraph 28.8

Why does VS2010 give syntax errors when syntax is correct?

北城以北 提交于 2019-11-29 11:55:27
I am having a problem with VS2010 (and VS2008) giving my a great list of syntax errors. However, the syntax is indeed correct. Here is a small example; I have the following code block inside a .h file // Prototype Declarations LIST* createList (int (*compare) (void*, void*)); LIST* destroyList (LIST* plist); int addNode (LIST* pList, void* dataInPtr); bool removeNode (LIST* pList, void* keyPtr, void** dataOutPtr); bool searchList (LIST* pList, void* pArgu, void** pDataOut); bool retrieveNode (LIST* pList, void* pArgu, void** dataOutPtr); bool traverse (LIST* pList, int fromWhere, void**

OpenSSL: can't build in VC++ 2010

早过忘川 提交于 2019-11-29 09:25:40
问题 I have downloaded the latest OpenSSL source package. I want to build it with VC++ 2010 x64. Following the instructions doesn't seem to work. Configure step looks fine, but then: C:\1>ms\do_win64a.bat C:\1>perl util\mkfiles.pl 1>MINFO C:\1>perl ms\uplink.pl win64a 1>ms\uptable.asm C:\1>ml64 -c -Foms\uptable.obj ms\uptable.asm Microsoft (R) Macro Assembler (x64) Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. Assembling: ms\uptable.asm C:\1>perl util\mk1mf.pl no

C++0x Lambda overhead

孤街醉人 提交于 2019-11-29 00:38:13
问题 Is there any overhead associated with using lambda expressions in C++0x (under VS2010)? I know that using function objects incurs overhead, but I'm referring to expressions that are passed to STL algorithms, for example. Does the compiler optimize the expression, eliminating what seems to appear like a function call? I started to really like lambda expressions, but I'm a bit concerned about the speed penalty. Thanks in advance! 回答1: You "know" that function objects incur overhead? Perhaps you

while installing vc_redist.x64.exe, getting error “Failed to configure per-machine MSU package.”

心已入冬 提交于 2019-11-28 21:21:00
While I am trying to install vc_redist.x64.exe on Windows 8.1 getting following error: Failed to configure per-machine MSU package. Soman Dubey Posting answer to my own question as I found it here and was hidden in bottom somewhere - https://social.msdn.microsoft.com/Forums/vstudio/en-US/64baed8c-b00c-40d5-b19a-99b26a11516e/visual-c-redistributable-for-visual-studio-2015-rc-fails-on-windows-server-2012?forum=vssetup This is because the OS failed to install the required update Windows8.1-KB2999226-x64.msu. However, you can install it by extracting that update to a folder (e.g. XXXX), and

Disabling C++0x features in VC 2010?

邮差的信 提交于 2019-11-28 13:24:25
Does C++0x mode in VC++ 2010 has an off switch? I am working on a project that supposed to compile on non 0x compilers, and therefore I want to compile against the current standard. (Even if non of the new features are being used directly, there are still subtleties that makes C++0x more premissive). The closest switch I found was Configuration Properties -> C/C++ -> Language -> Disable Language Extensions but that's not it. No, language extensions are typically non-standard vendor specific additions. C++0X features: There is no direct way to switch off these features. One workaround is to not