Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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);
#endif

We have played with c++0x a lot and now when gcc supports some of the features we will use them as soon as they are available. The reason is simple - with auto keyword you save a lot of typing, with rvalue references you get performance gains and with initializer lists and variadic templates less typing and much more readable code.

Actually the major goals of c++0x standard are our goals too, because we will have advantage to our competitors with these features. That's why we are going to use them without waiting at all. Of course if you need multi platform compatibility, this step is not acceptable. In case you don't care about it, use it immediately and you can only win.

Yes I'm already using C++0x and releasing open source libraries and code. All of my future C++ open source projects will be written in this variant. After using variadic template parameters and decltype/auto I can't go back!

I will start using it when Visual Studio FULLY supports it. Right now VS10 only supports a few features.

We are still in the process of switching from VS6 to VS 2005. We probably wont be using exclusively C++0x compilers for new work until late 201x.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top