I am working on a product which uses C++ primarily for its core components. Though it uses Visual C++ as the primary compiler for the Windows platform and its editor and debugger as the primary developing environment, is not using any Microsoft specific technologies. For other platforms it uses gcc for compilation.
My code base heavily uses emulated rvalue references (using the Boost move library), variadic templates (using the Boost processor) and in some cases expression templates.
I am tempted to switch to C++11 to get a cleaner code base using rvalue reference, perfect forwarding, default and delete for constructors, variadic templates, and auto and decltype.
If I do so, I may do some rework on the existing code to simplify it (using template aliases and maybe constexpr). In that case, I have to switch to gcc for the Windows platform using mingw, as Visual Studio has no implementation for default and delete, and variadic template. Also, I have to switch to gdb as debugger and a different code editor.
For me the benefit looks huge in terms of code simplicity and performance, however stability, availability (on some platform such as Android) , debugging (migrating from Visual Studio to gdb, as we have many visualization tools developed for Visual Studio debugger) and code editor (not so much as for heavily templates code I do not find much use of auto-completion, refactoring etc, and Codelite, Codeblocks, QtCreator works well with our build system) are some of the issues.
I like to know if any of the medium/large scale projects, either commercial or open source, use/intend to use any of the above C++11 features? And how much effort is required to do such migration?
Any practical experience, tips or words of wisdom will help me to take a decision.
First of all: it depends on the policy.
Like all technologies, switching from something that works to something new is a risk in itself. Depending on your mindset and the criticity of your project, the degree of risk you accept may differ (for example, I use the top of tree version of Clang for personal projects but a mature gcc at work).
Personally, I would recommend not diving head-first for production ready projects, but instead perform a piecemeal selection of the features that work.
You mentionned:
default
/delete
auto
/decltype
)constexpr
VC++11 comes with support for many C++11 features. You could start using rvalue references and type inference right now, for example. And those can be used with gcc 4.5.x branch if I recall correctly, which is already more than a year old, so well worn.
One notable absence from your list are lambdas for example, which are supported by both VC++11 and gcc too.
If you want to move further, then you will have to switch compiler and environment. The effort is significantly greater as you will need to retrain the team (personally I have had some warts with gdb on mingw...).
I would advise cherry picking what works on both compilers, for now, unless you feel adventurous. Migration is always a business risk though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With