tags:

views:

1826

answers:

22

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?

+44  A: 

auto keyword for variable type inferencing

Mark Cidade
I dream about auto. When available, I will use it in every single statement. So much goodness in 4 characters.
QBziZ
Auto is already implemented in GCC 4.4! And it's awesome.
coppro
woohoo! No more guessing how many asterisks to add to the type ; )
Mark Cidade
Yay auto! No more "for (vector<pair<int, string> >::const_iterator i;...."!
David Thornley
yeah.. it's funny how the most trivial change in C++0x is the most popular. It _is_ what we coders care about after all :) and yes it's awesome.
The for(int x : contanier) is the same kind of goodie. Hope it will get accepted.
kyku
+15  A: 

Threads and atomics.

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

G.

graham.reeds
Except that it couldn't be. As an ISO standard, it cannot be revised more than once every 10 years. So October 10, 2008 is the earliest that a new standard could be set. Note that the final meeting was in September, expect ratification sooner rather than later.
Zathrus
what? Where did you get that rule from? The committee is planning to make more frequent (~5 year intervals) updates to the standard after 0x. And of course, C++98 and '03 seem to have less than 10 years between them.
jalf
+27  A: 

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.

Chris Charabaruk
GC prevents RAII. I'd rather have smart pointers and RAII than GC.
Bernard
Oh no it doesn't! RAII is in Lisp, C# although a little different from C++, but C++/CLI it has destructors on GCed classes that behave identically to C++ destructors.
Daniel Earwicker
C++0x is in your base adding to your codes. gotta love the lambdas and initializer lists.
acidzombie24
+6  A: 

Closures for me.

TraumaPony
+6  A: 

auto keyword

Andrew Stein
+5  A: 

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.

lambda/closures can't be done (efficiently) without language support.
Simon Buchan
I wouldn't want to force something like Quaternions, GIL or BGL on all vendors. A code review is mostly irrelevant, as the standard only describes the interface contract - which often isn't specified in boost. Boost will describe its implementation only.
MSalters
+19  A: 

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.

Robert Gould
i assume you mean rvalue references, we already have rvalues
jk
thanks for the correction jk
Robert Gould
+10  A: 

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

Greg Rogers
Too bad the committee decided not to include concepts in C++0x
David Lin
I'm actually glad it isn't there. Opinion: It would have been a messy embarassment that not even half of the C++ committee really understood.
sellibitze
I think most people agree that concepts were a good idea, they just couldn't nail down a suitable implementation soon enough.
Greg Rogers
+8  A: 
  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.

+5  A: 

Lambdas and Concepts

yesraaj
Concepts are out I'm afraid.
tragomaskhalos
+8  A: 

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.

kervin
+17  A: 

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

Eclipse
+3  A: 

The syntax going from bad to worse.

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

DrPizza
+2  A: 

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.

Niklas
I already had smart pointers in my code, from Boost. I'm more interested in the changes that I can't do on my own.
David Thornley
OK. FYI, the boost smart pointers are the basis for the C++0x smart pointers.
Niklas
Also shared_ptr was standardised in TR1, so it's not actually new in C++0x.
Daniel Earwicker
unique_ptr though much better than auto_ptr
jk
@Daniel Earwicker: TR1 is not a standard. It's a technical report with proposals of things to include in 0x. See http://en.wikipedia.org/wiki/C%2B%2B_Technical_Report_1
Niklas
+6  A: 

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

Michael Burr
that should be nullptr shouldn't it
Jamie Cook
+2  A: 

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;
Motti
You have to start your literals with _ (non-_ literals are reserved for future use for the standard). Which is a shame.
coppro
Are you sure about that? I had a look at the latest version (N2378) and didn't see that information.
Motti
Yeah. It's in the library requirements section, under program requirements.
coppro
+9  A: 

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.

Roddy
Putting useful stuff into a standard increases the chance that it'll get into the toolchains. It's a start.
David Thornley
A: 

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

Jace Jung
A: 

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!

Rizo
+1  A: 

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;
Lorenzo
+1  A: 

decltype :-) and lambdas

Prasoon Saurav
A: 

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.

Stephane Rolland