std::async won’t spawn a new thread when return value is not stored

From just::thread documentation: If policy is std::launch::async then runs INVOKE(fff,xyz…) on its own thread. The returned std::future will become ready when this thread is complete, and will hold either the return value or exception thrown by the function invocation. The destructor of the last future object associated with the asynchronous state of the returned std::future … Read more

How to convert Platform::String to char*?

Here is a very simple way to do this in code w/o having to worry about buffer lengths. Only use this solution if you are certain you are dealing with ASCII: Platform::String^ fooRT = “aoeu”; std::wstring fooW(fooRT->Begin()); std::string fooA(fooW.begin(), fooW.end()); const char* charStr = fooA.c_str(); Keep in mind that in this example, the char* is … Read more

Does the standard mandate an lvalue-to-rvalue conversion of the pointer variable when applying indirection?

I think you’re approaching this from a rather oblique angle, so to speak. According to ยง5.3.1/1: The unary * operator performs indirection: the expression to which it is applied shall be a pointer to an object type, or a pointer to a function type and the result is an lvalue referring to the object or … Read more

Globbing in C++/C, on Windows

Link with setargv.obj (or wsetargv.obj) and argv[] will be globbed for you similar to how the Unix shells do it: http://msdn.microsoft.com/en-us/library/8bch7bkk.aspx I can’t vouch for how well it does it though.

popen equivalent in c++

You can use the “not yet official” boost.process if you want an object-oriented approach for managing the subprocess. Or you can just use popen itself, if you don’t mind the C-ness of it all.

Using Boost adaptors with C++11 lambdas

http://smellegantcode.wordpress.com/2011/10/31/linq-to-c-or-something-much-better/ But you can use this, that works well. #include <boost/range/adaptors.hpp> #include <boost/range/algorithm.hpp> #include <vector> #include <functional> int main() { std::vector<int> v{ 1,5,4,2,8,5,3,7,9 }; std::function<int(int)> func = [](int i) { return -i; }; std::cout << *boost::min_element(v | boost::adaptors::transformed( func)) << std::endl; return 0; } http://liveworkspace.org/code/b78b3f7d05049515ac207e0c12054c70 #define BOOST_RESULT_OF_USE_DECLTYPE works fine in VS2012 for example.