I’ve been thinking for some time now that I should test drive the new C++11 features a bit more seriously, but I’ve not really had the spare time to do it or I just haven’t managed to decide on exactly how I wanted to do it. Now that I’ve installed Visual Studio 11 Beta, which already ships with a lot of all the new C++11 features, I decided to just jump in head-first.
So, this is the deal:
- I’ll walk my way (slowly) through the new features that interest me the most, using the VS11 implementation of C++11.
- I’ll divide my journey into small-ish pieces that are easy enough to also blog about.
- I’ll take lots of detours into neighboring areas as I create supporting infrastructure to accomplish what I want and need.
- I’ll create “something real” without using any off-the-shelf libraries or tools, because I want to be self-sufficient using C++11, good old general C++ and a large portion of what I consider best practices.
Provided that VS11 supports these items, this is what I want to look closer at:
- Rvalue references and move constructors
- Type inference: auto, decltype
- Range-based for-loop
- Lambda functions
- Explicit overrides
- Null pointer constant
- Strongly typed enumerations
- Explicitly defaulted and deleted special member functions
- Static assertions
- Multithreading: std::thread, std::mutex, std::recursive_mutex, std::condition_variable, std::condition_variable_any, std::lock_guard, std::unique_lock, std::async, std::packaged_task, std::future, std::promise
- Hash sets: std::unordered_set, std::unordered_multiset, std::unordered_map, std::unordered_multimap
- Smart pointers: std::unique_ptr, std::shared_ptr, std::weak_ptr
- Extensible random number facility: 3 generators and a number of distributions
Where applicable, I will also look at the features from a performance perspective, what magic the compiler manages to pull off and what differences we’ll get at an assembly level by choosing to do this instead of that.