Question

As many of us know (and many, many more don't), C++ is currently undergoing final drafting for the next revision of the International Standard, expected to be published in about 2 years. Drafts and papers are currently available from the committee website. All sorts of new features are being added, the biggest being concepts and lambdas. There is a very comprehensive Wikipedia article with many of the new features. GCC 4.3 and later implement some C++0x features.

As far as new features go, I really like type traits (and the appropriate concepts), but my definite leader is variadic templates. Until 0x, long template lists have involved Boost Preprocessor usually, and are very unpleasant to write. This makes things a lot easier and allows C++0x templates to be treated like a perfectly functional language using variadic templates. I've already written some very cool code with them already, and I can't wait to use them more often!

So what features are you most eagerly anticipating?

Was it helpful?

Solution

auto keyword for variable type inferencing

OTHER TIPS

Lambdas and initializer lists.

Also, the changes to make it easier to eventually bring C++ into a garbage collected model, those seem pretty interesting. Perhaps C++1x will actually bring in garbage collection, but 0x/10 just set things up for the eventuality.

I want Rvalues references.

All the other new features are stuff that we could easily live without(alas features). However the lack of Rvalues in C++ so far has caused hundreds of template library authors to have to "hack" around the broken Rvalue ref issue.

Variadic templates! (Which combined with r-value references gives us perfect forwarding!)

Threads and atomics.

With multicore processors now the norm C++0x should have been C++07.

G.

Strongly Typed enums get my vote. Pascal has only had these for around 40 years, so it's good to see C++ finally catching up.

However, the publication of the standard is really a non-event. What's much more important is when the features you want to use are actually fully and reliably supported with real-world toolchains. There are folk that seem to actually enjoy writing standards-compliant code that fails to compile on any known compiler. Good luck to them.

  1. It has to be the incorporation of some of the Boost libraries (shared_ptr<> and bind top the list)

  2. Control over template instatntiation should finally solve the issue of the enormous compile times and make it actually feasible to use modern template code in large projects.

  3. Template typedefs

Lots of other small but important things, but they do matter in production code.

Hands down concepts for me. But initializer lists, lambdas, and variadic templates are a close second.

I can't decide between Null Pointer Type, Tuple Types, or Regex. 'Foreach' is up there too. 'Smart Pointers' goes without saying... :-)

Basically, I'm really looking forward to the update.

Personally I think heavy use of the null pointer type is going to catch a lot of bugs. Tuples are great for dealing with relational data. Lots of cool stuff.

It's not big, but I'm loving the idea of a true nullptr. Should have been a keyword right from the git-go.

Closures for me.

auto keyword

Lambdas and Concepts

Angle bracket in nested template declarations.

So I will be able to write

std::vector<std::vector<int>> a;

instead of the horrible

std::vector<std::vector<int> > a;

The for (auto x : collection) iteration syntax is way cool I think... it literally cuts down the size of many loop headers by a factor of 4 or more (iterator types are often ... verbose)!

It also means you don't have to dereference the iterator in the body of the loop (with a traditional iterator loop, you always have to use *i or i->... to get the value of the element, but here you can just use x), which in some cases makes the code look much nicer.

unicode, multithreading, hash_tables, smart pointers and regular expressions.

ps : Wonder why they just cant do a gr8 code review and accept all the boost and tr1 libs into the standards and make life easier for everyone. All they would then have to solve is agreeing on a working optional garbage collection model.

Smart pointers. It really makes a world of difference not having to explicitly memory-manage heap-allocated objects.

Obviously you still need to "know what you're doing", but in my experience it has decreased the number of memory-related bugs at least one order of magnitude in software I've worked with.

The syntax going from bad to worse.

Variadic templates and lambdas are nice, though the syntax of both is unfortunately pretty objectionable.

I like constexpr especially in conjunction with variadic templates and user defined literals we can finally have binary literals and lots of other goodies.

obj.bitmask |= 00001010B; 

decltype :-) and lambdas

REGEX!! and parallel programming librarys though I don't know the features of them all yet.

Raw string literals! I thought that python-like string blocks were awesome, but I was wrong! In C++0x raw string literals are incredibly useful for text formatting. Markup languages can be wrote directly in your source!

for the moment I have liked much of C++0x that I have played with:

  • nullptr
  • static_assert
  • lambdas
  • shared_ptr and weak_ptr
  • unique_ptr
  • decltype and auto

I havent tried <regexp>... I thought it was a huge idea... but I didn't even take the time to look at it.

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