tags:

views:

414

answers:

3

For example, "Don't return objects by value if they are expensive to copy" (RVO can't always be used). This advice might change because of rvalue references.

The same might be said about storing collections of pointers to objects, because copying them by value into the collection was too expensive; this reason might no longer be valid.

Or the use of enums might be discouraged in favour of "enum class".

What other practices or tips will change?

+5  A: 

Improved code locality by using lambda expressions.

Pavel Radzivilovsky
+4  A: 

Rvalue references is not a replacement for RVO or NRVO. Returning large things by value is still silly - it's just less silly when the class is actually small and holds heap memory. Passing in a reference to the return value is still best practice, imo.

Function objects as raw structs/classes will be deprecated in favour of lambdas.

I can't really think of much, to be honest. C++0x seems to make existing code simpler, rather than actually change it.

DeadMG
"C++0x seems to make existing code simpler, rather than actually change it." Exactly. The master said: "Source Code Rejuvenation is not Refactoring"
AraK
+9  A: 

I expect that C++ written in a functional-like style will become more prevalent because:

  • Lambda expressions make using the standard library algorithms much easier
  • Move semantics make returning standard library or other RAII container objects significantly cheaper
James McNellis
Regarding move semantics: or any "resource owner" class. We could even return locks now :)
Matthieu M.
@Matthieu: Right; I meant "container" in the "RAII container" sense, not the "standard library container" sense; I've added language to clarify. Thanks!
James McNellis
I'm marking this as the best answer; but I suspect this can be expanded as C++0x becomes more prevalent.
Jon