c++0x

Will C++0x support __stdcall or extern "C" capture-nothing lambdas?

Yesterday I was thinking about whether it would be possible to use the convenience of C++0x lambda functions to write callbacks for Windows API functions. For example, what if I wanted to use a lambda as an EnumChildProc with EnumChildWindows? Something like: EnumChildWindows(hTrayWnd, CALLBACK [](HWND hWnd, LPARAM lParam) { //...

Visual C++ 2010 atomic types support?

Does VC++ 2010 have support for C++0x's portable atomic type template? ...

What C++0x features does Visual Studio 2010 support?

There is a list for GCC; is there a similar list for Visual Studio 2010? ...

How to use autoconf with C++0x features

What are the best practices for using autoconf in conjunction with shared_ptr and other TR1/BOOST C++0x templates so as to maximize portability and maintainability? With autoconf I can determine whether shared_ptr is available as std::tr1::shared_ptr and/or boost::shared_ptr. Given that the same feature has two different names, I have...

How to declare a function that accepts a lambda?

I read on the internet many tutorials that explained how to use lambdas with the standard library (such as std::find), and they all were very interesting, but I couldn't find any that explained how I can use a lambda for my own functions. For example: int main() { int test = 5; LambdaTest([&](int a) { test += a; }); return...

How to determine if std::chrono::monotonic_clock is available?

C++0x N3092 states that monotonic_clock is optional: 20.10.5.2 Class monotonic_clock [time.clock.monotonic] Objects of class monotonic_clock represent clocks for which values of time_point never decrease as physical time advances. monotonic_clock may be a synonym for system_clock if system_clock::is_monotonic is true. The c...

Problem with futures in c++0x .

Hi, I have written a small program , to understand how futures work in c++0x. while running the code I get an error like " error: 'printEn' was not declared in this scope". I am unable to understand what the problem is..Kindly point out what I am doing wrong here and if possible write the correct code for the same.. #include <future> #i...

Can I upgrade Xcode to support a newer version of GCC to learn C++0x?

I would like to jump in learn C++0x, which has matured to a level I'm happy with. Xcode on Snow Leopard 10.6 is currently at GCC 4.2.1, and the new features I'd like to try, like std::shared_ptr, lambdas, auto, null pointer constant, unicode string literals, and other bits and pieces, require at least 4.3 (I believe). Ideally I'd use X...

Strongly typed `enum`s in VS10?

Possible Duplicate: forward/strong enum in VS2010 This question pointed to a wiki page for C++0x support which lists Strongly typed enums as Partially supported in VS10. However the following is a compilation error: enum class boolean { no, yes, maybe }; Any idea what constitutes partial support when the basic syntax is...

How to pass data to a C++0x lambda function that will run in a different thread?

Important update: Apparently I drew the wrong conclusion when I asked this question. Thanks to the responses I found out the lambda function [=]() does work fine in a multithreaded scenario. My apologies for posing this confusing question. Please vote to close, as it was a non-issue. In our company we've written a library function to ...

How do I compile variadic templates conditionally?

Is there a macro that tells me whether or not my compiler supports variadic templates? #ifdef VARIADIC_TEMPLATES_AVAILABLE template<typename... Args> void coolstuff(Args&&... args); #else ??? #endif If they are not supported, I guess I would simulate them with a bunch of overloads. Any better ideas? Maybe there are preprocessor li...

C++0x error : variable 'std::packaged_task<int> pt1' has initializer but incomplete type

Hi All, Below is a simple program in c++0x that makes use of packaged_task and futures. while compiling the program i get error : variable 'std::packaged_task pt1' has initializer but incomplete type the program is below #include <future> #include <iostream> using namespace std; int printFn() { for(int i = 0; i < 100; i++) ...

unique_ptr boost equivalent?

Is there some equivalent class for C++1x's std::unique_ptr in the boost libraries? The behavior I'm looking for is being able to have an exception-safe factory function, like so... std::unique_ptr<Base> create_base() { return std::unique_ptr<Base>(new Derived); } void some_other_function() { std::unique_ptr<Base> b = create_bas...

variadic constructors

Are variadic constructors supposed to hide the implicitly generated ones, i.e. the default constructor and the copy constructor? struct Foo { template<typename... Args> Foo(Args&&... x) { std::cout << "inside the variadic constructor\n"; } }; int main() { Foo a; Foo b(a); } Somehow I was expecting this to ...

GNU C++ how to check when -std=c++0x is in effect?

My system compiler (gcc42) works fine with the TR1 features that I want, but trying to support newer compiler versions other than the systems, trying to accessing TR1 headers an #error demanding the -std=c++0x option because of how it interfaces with library or some hub bub like that. /usr/local/lib/gcc45/include/c++/bits/c++0x_warning....

C++0x threading

With the advent of threading facilities in the STL for the new C++ standard (C++0x), will it be better to change existing code that is using POSIX threading or even Windows threading to use STL threading? ...

Is there a C++0x syntax file for vim?

In particular, the display of initialization lists is really bad: vector<int> v({1,2,3}); will highlight the curly braces in red (denoting an error.) ...

How do you use C++0x raw strings with GCC 4.5?

This page says that GCC 4.5 has C++ raw string literals: http://gcc.gnu.org/projects/cxx0x.html But when I try to use the syntax from this page: http://www2.research.att.com/~bs/C++0xFAQ.html#raw-strings #include <iostream> #include <string> using namespace std; int main() { string s = R"[\w\\\w]"; } I get this error: /opt/...

Boost.Asio: The difference between async_read and async_recieve

What's the difference between async_read and async_receive? ...

Does a no-op "do nothing" function object exist in C++(0x)?

I realize this is a ludicrous question for something that takes less than 2 seconds to implement. But I vaguely remember reading that one was introduced with the new standard. I grep'ed VC10's headers and came up with nothing. Can you help? It's bugging me! :) edit: On second thought, the new functor I was remembering was probably the ...