Tutorial :Have You Started Using C++0x?


Most of the compilers already support C++0x. Have you started using C++0x or are you waiting for the definition of x? I have to do some refactoring of my code; should I start using the new features?


C++0x is not a completed standard yet. It's likely that there will be many revisions before an international accepted standard is released. So it all depends, what are you writing code for? If it's for an work-assignment i would stick with regular C++, wait for the standard to be set and give the programming community the time it takes to adjust. Don't refactor code you really need to implement, it might give you a loot of trouble.

I however think C++0x great to play around with and also it can't hurt to be familiar with the syntax when 0x is globally accepted.


I've started using nullptr, using #define nullptr 0 for those compilers (i.e. most) that don't support it yet.


From the link you have provided, it looks like you actually mean TR1, not really C++0x. And yes, I am using most of the new TR1 libraries for quite some time, because many of them are former Boost libraries.

And I can only encourage everyone to use them as well.


I would hold off on writing production code until '0x+y, where y is when they work the bugs out of the compiler and bring it into standard complience (whatever the standard may be).

But for development? I use it for playing around, writing project euler, etc. I use it on presentations and newsgroups as well.


There are very few compilers that support something. Actually VS supports only TR1 libraries, gcc supports some features like variadic templatres, rvalue, auto and some more. Intel compiler has some.

I mostly started using variadic templates like:

#ifdef HAvE_VARIADIC  template<typename... Args>  void format(std::string,Args... args);  #else  template<typename T1>  void format(std::string,T1 p1);  template<typename T1,typename T2,>  void format(std::string,T1 p1,T2 p2);  ...  template<typename T1,typename T2,...,typename T10>  void format(std::string,T1 p1,T2 p2,..., T10 p10);  

Next Post »