Re:C++ concepts support merged into GCC trunk
by ArtB on Friday August 07, 2015 @10:33PM
(#10026111)
Any summary on what was omitted? I'm not a C++ programmer so going to the source wouldn't help me much, but I'd love to know.
Re:C++ concepts support merged into GCC trunk
by maxlybbert on Monday August 10, 2015 @08:16AM
(#10034022)
I hadn't followed the original proposal closely, so I can't give a complete list. One feature I know about, that was implementable but very expensive, was the ability to specify multiple ways that a type could match a concept. For instance, a Sortable concept could mean the type has an operator<, or could be passed to the function compare(). I'm sure there was a way to handle cases where a type had both. But then, if you had a type with a method, say lessThan(), you could somehow specify that was an acceptable operator<, and then use anything that relied on the Sortable concept. As far as I know, that isn't in "concepts light."
Surprisingly, they resisted Hoare's "mad dash" and deferred concepts. This article is about a stripped-down version of concepts that was accepted into the upcoming version of C++. It's supposed to have most of the benefits of the C++11 proposal, without the complexity.
But I have to admit that the main benefits are better error messages, explicit comments in code of what a template requires, and an additional syntax for declaring/defining templates. The C++11 proposal was more exciting, but there was a question of whether it went too far.