C++ International Standard final draft is ready
herbsutter.com
herbsutter.com
So, taken from: http://www2.research.att.com/~bs/C++0xFAQ.html#lambda
You could write something like:
void f(vector<Record>& v)
{
vector<int> indices(v.size());
int count = 0;
fill(indices.begin(),indices.end(),[&count](){ return ++count; });
// sort indices in the order determined by the name field of the records:
std::sort(indices.begin(), indices.end(), [&](int a, int b) { return v[a].name<v[b].name; });
// ...
}* C-like functions (main)
* headers (iostream)
* namespaces (std)
* operator overloading (<<)
* object-orientation (cout is an instance of a class that is derived from ios and ios_base)
* templates (endl is a template function)
It does use that one predefined object std::cout and its overloaded operator. But other than that plus namespaces, it's not using features that aren't available in C.
I disagree that it uses most features of the language, at least not in any direct or visible way. There are a lot of features it doesn't use.
- Expected notation for angle brackets (vector<vector<string>> versus vector<vector<string> >).
- Type inference using the 'auto' keyword.
- Initializer lists.
- Range-based loops.
- Strongly-typed enumerations.
- Delegation in constructors (constructor-constructor calls).
- Incorporation of TR1, which brings stuff like shared_ptr and containers based on hashing (unordered_map/unordered_set).
This is the one I'm looking forward to. Maybe I won't have to typedef every stl container I use just to make my code readable.
Just being able to infer the type in the right side of an expression is rubbish.