cschleiden
Published on

Concepts won't be in C++0x

Authors

On Monday I heard a talk given by Michael Wong (IBM Canada) and he told us - and he also wrote in his blog - about the last C++0x Standard Committee meeting in Frankfurt, Germany:

At this meeting, Concepts, the major feature of C++ 0x, which enables constrained genericity, or template argument prototyping, has been removed from the C++0x draft.

So at this point another major feature of C++0x won't be included in the final release of the standard (and the ETA was shifted to 2010/2011 instead of 2009/2010). While C++0x has many features I'm very anxious about (think lambda functions, the auto keyword, double angle brackets in template declarations, etc.) I really wanted concepts in the new standard.

Over the past year I have been – and I still do – writing a linear algebra template library in order to try out new methods to exploit parallelization in an object oriented environment (my bachelor’s thesis titled “Exploiting Object Orientation to Parallelize and Optimize C++ Applications” will include a more detailed explanation and evaluation). It would have been really great to be able to specify certain contraints for the generic types the way, for example, C# allows you to limit the usage of parameters in Generics. With the removal of concepts, the only way is to use the STL convention of specifying Concepts, which types must adhere to, but with no real representation in the code and especially no checking through the compiler.

However, even though I was looking forward to this feature I understand the reasons for not including them (see N2906 by Bjarne Stroustrup), C++ is already a very difficult language to teach to beginners. In my opinion the real value and great advantage of C++ lies in the various usage possibilities of template (see template expressions, or general template metaprogramming) and when explaining these concepts to new C++ programmers you nearly always make their head spin..

UPDATE

There are now two new blog posts by Herb Sutter and Bjarne Stroustrup himself about this topic:

Herb Sutter – Trip Report: Exit Concepts

and Bjarne Stroustrup The C++0x “Remove Concepts” decision