What is your favorite C ++ 0x feature?

As many of us know (and many, and many others do not), C ++ is currently being finalized for the next revision of the International Standard, which is expected to be published in about 2 years. Drafts and documents are currently available on the website. All new features, the biggest concepts and lambdas are added. There is a very extensive Wikipedia article with many new features. GCC 4.3 and later are some of the features of C ++ 0x .

Regarding new features, I really like type traits (and related concepts), but my definite leader is variable templates. Prior to 0x, long lists of templates included Preprocessor Boost as a rule, and it was very unpleasant to write. This simplifies the work and allows you to treat C ++ 0x templates as a completely functional language using variable templates. I have already written very cool code with them, and I can no longer wait for their use!

So what features do you most expect?

+41
c ++ c ++ 11
Sep 26 '08 at 4:43
source share
23 answers

auto keyword for variable type input

+63
Sep 26 '08 at 4:47
source share

Lambdas and initializer lists.

In addition, the changes that ultimately bring C ++ to garbage collection look pretty interesting. Perhaps C ++ 1x will really introduce garbage collection, but 0x / 10 will just install everything possible.

+34
Sep 26 '08 at 5:00
source share

I want Rvalues ​​links.

All other new features are things that we could easily live without (alas). However, the lack of Rvalues ​​in C ++ has so far forced hundreds of template library authors to “crack” a problem with fixing Rvalue ref.

+25
Sep 26 '08 at 5:04
source share

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

+22
Sep 26 '08 at 6:00
source share

Themes and atoms.

Now with multi-core processors, the C ++ 0x norm should have been C ++ 07.

G.

+17
Sep 26 '08 at 4:52
source share

Heavily printed listings get my vote. Pascal only had them for about 40 years, so it's good to see that C ++ is finally catching up.

However, the publication of the standard is indeed a non-event. More importantly, when the features you want to use are actually fully and reliably supported using real toolkits. There are people who seem to really enjoy writing standard compatible code that doesn't compile in any known compiler. Good luck to them.

+15
Oct 29 '08 at 21:24
source share
  • This should be the inclusion of some of the Boost libraries (shared_ptr <> and top list binding)

  • Control over the installation of the template should finally solve the problem of huge compilation time and make it actually possible to use a modern code template in large projects.

  • Typedefs templates

There are many other small but important things, but they do matter in production code.

+11
Sep 26 '08 at 5:16
source share

Hands down for me. But initializer lists, lambdas and variadic templates are close seconds.

+10
Sep 26 '08 at 5:08
source share

I cannot decide between Null Pointer Type , Tuple Types , or Regex . "Foreach" is there too. Smart pointers needless to say ... :-)

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

Personally, I think that heavy use of the null pointer type will catch a lot of errors. Tuples are great for relational data processing. A lot of cool stuff.

+10
Sep 26 '08 at 5:25
source share

It's not big, but I love the idea of ​​true nullptr . There should be a keyword to the right of git -go.

+8
Sep 29 '08 at 6:30
source share

Closing for me.

+7
Sep 26 '08 at 5:01
source share

auto keyword

+7
Sep 26 '08 at 5:01
source share

Lambdas and Concepts

+5
Sep 26 '08 at 5:18
source share

An angle bracket in nested template declarations.

So I can write

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

instead of terrible

 std::vector<std::vector<int> > a; 
+5
Jun 25 '10 at
source share

The iterative syntax for (auto x : collection) looks cool, I think ... it literally reduces the size of many outline headers by 4 or more times (iterator types often ... verbose)!

It also means that you don’t need to dereference the iterator in the body of the loop (with a traditional iterator loop, you always need 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 much nicer.

+5
Nov 16 2018-10-11T00:
source share

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

ps: I wonder why they simply cannot view the gr8 code overview and take all levels of boost and tr1 into standards and make life easier for everyone. All they needed to solve was agreeing to a working, optional garbage collection model.

+4
Sep 26 '08 at 5:03
source share

Smart pointers. It really makes a world of difference without explicit memory - it manages a bunch of objects.

Obviously, you still need to “know what you are doing,” but in my experience it has reduced the number of memory errors by at least one order in the software I worked with.

+3
Sep 26 '08 at 20:41
source share

The syntax goes from bad to worse.

The Variadic and lambdas templates are good, although the syntax of both is unfortunately rather undesirable.

+2
Sep 26 '08 at 16:38
source share

I like constexpr , especially when combined with variable templates and user-defined literals, we can finally have binary literals and many other goodies.

 obj.bitmask |= 00001010B; 
+2
Oct 26 '08 at 10:09
source share
+2
Sep 18 2018-10-10T00:
source share

REGEX !! and parallel programming libraries, although I do not yet know their functions.

+1
May 29 '09 at 2:12
source share

String literals ! I thought string blocks like python were awesome, but I was wrong! In C ++ 0x, raw string literals are incredibly useful for formatting text. Markup languages ​​can be written directly at your source!

+1
Jun 25 '10 at 10:30
source share

At the moment, I liked most of the C ++ 0x I played with:

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

I have not tried <regexp> ... I thought it was a great idea ... but I did not even find time to look at it.

0
Oct 29 '10 at 12:24
source share



All Articles