Concept Checking in C++11—Eric Niebler

Save to:
Instapaper Pocket Readability

While we're waiting for Concepts Lite, Eric shows how we can already do quite a bit in C++11 while planning for a transition to language support when it's available.

Concept Checking in C++11

by Eric Niebler

From the article:

This post describes some utilities I’ve recently developed for doing concept checking in C++11. These utilities are part of an ongoing project to reimplement ranges, also for C++11, but I think the concept checking utilities are useful and interesting in their own right...

Add a Comment

Comments are closed.

Comments (2)

0 0

asceai said on Nov 25, 2013 01:51 PM:

I didn't even know it was possible to implement something like valid_expr in C++11. If we have that are concepts really needed?
0 0

Eric Niebler said on Nov 25, 2013 03:32 PM:

Yes, concepts are needed. The part about concepts-based overloading explains one reason why. Other reasons are that the syntax isn't really great, lots of hacks are needed (e.g. `same_type`, `convertible`, and some very strange contortions for valid expressions of type `void`), and the error messages from a library solution are never going to be as good as from a built-in language feature. But the library solution is a good stop-gap. Certainly, we can get much farther in C++11 than we could in C++98.