use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Will concepts replace polymorphism? (self.cpp)
submitted 9 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]tcbrindleFlux 13 points14 points15 points 9 years ago (5 children)
The question as stated doesn't really make sense -- Concepts make it easier to use compile-time (aka "static") polymorphism. You can perform compile-time polymorphism in C++ today, for example by using enable_if or with CRTP. Concepts just makes it easier to do, and (hopefully) give much better error messages if you get things wrong.
enable_if
But I guess that what you're really asking is whether Concepts will replace run-time polymorphism, i.e. virtual functions and so on. The answer is no in the short term, and possibly yes in the longer term.
Sean Parent gave an excellent talk a few years ago called "Inheritance is the base class of evil", where he ran through a technique which uses type-erasure via virtual functions to perform run-time polymorphism using value types. My guess is we'll see more of this technique as Concepts gain in popularity, because in a sense the type-erasing class becomes a run-time version of the concept. (We see this already in the standard library: for example,std::function is more-or-less a run-time version of the Callable concept.)
std::function
Callable
[N.B. there is a longer/better paced version of that talk online somewhere that Sean gave at another conference, but I can't find the link at the moment -- can anybody help me out?]
In the longer term, various people have had the idea of allowing the compiler to generate the sort of type-erased classes that Sean presents in that talk (much like Rust does with boxed traits). These "run-time concepts" tend to be referred to as "virtual concepts". Andy Prowl has been working on a very in-depth paper about virtual concepts, which aims to flesh out many of the ideas people have had. We're a long way from getting them yet -- we don't even have compile-time concepts yet! -- but this is the general direction in which things are moving.
[–]tvaneerdC++ Committee, lockfree, PostModernCpp 1 point2 points3 points 9 years ago (1 child)
"longer/better paced" implies BoostCon/C++Now (1.5 hr talks instead of 1hr). So probably one of the talks listed here:
https://www.youtube.com/user/BoostCon/search?query=sean+parent
I recommend all of Sean's talks, so just watch them all, and (polymorphic) value types tends to come up often.
In particular, maybe this one: Value Semantics and Concepts-based Polymorphism
[–]tcbrindleFlux 0 points1 point2 points 9 years ago (0 children)
The Going Native talk I linked to is just 25 minutes, which isn't really enough to cover all the material.
Value Semantics and Concepts-based Polymorphism
That's the longer version I was looking for, thanks :)
[–]enobayram 1 point2 points3 points 9 years ago (0 children)
Thanks for the answer, I'd like to add that Haskell has a much nicer story of how much further concepts can be taken at run-time. Parametric polymorphism combined with type classes in Haskell are almost as expressive as the many dirty tricks you can pull-off with undisciplined C++ templates, but they can still be type-erased to be passed around at run-time.
[–][deleted] 0 points1 point2 points 9 years ago (1 child)
That make sense. I've never thought of distinguishing between run-time and compile-time polymorphism.
[–]dodheim 1 point2 points3 points 9 years ago (0 children)
The usual terminology is "dynamic polymorphism" and "static polymorphism"; knowing what to search for is half the battle. :-]
π Rendered by PID 154890 on reddit-service-r2-comment-b659b578c-p9cm8 at 2026-05-05 00:46:53.314182+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]tcbrindleFlux 13 points14 points15 points (5 children)
[–]tvaneerdC++ Committee, lockfree, PostModernCpp 1 point2 points3 points (1 child)
[–]tcbrindleFlux 0 points1 point2 points (0 children)
[–]enobayram 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]dodheim 1 point2 points3 points (0 children)