3 ms·
I revisited the concepts pdf (which can be found in the original post) and it has a `requires` statement, which allows to combine multiple constraints on the ty
by enqk 11y ago
I revisited the concepts pdf (which can be found in the original post) and it has a `requires` statement, which allows
to combine multiple constraints on the types of a templated construction.
This would allow to write (your `Cloneable Iterator` idea)
template <ForwardIterator T>
requires CopyConstructible<T>
void copy(T a, T b)
Java Interfaces and C++ Concepts: the later being much more open, and Java interfaces being closed under types (C++ requires statement can have boolean const expressions in them)
I think the definition of good concepts is going to be hard that is for sure, however when one find a good one (one that can be shared within a programming community the way mathematical concepts are shared) then it will convey just the right amount of information for a community to understand the code they share.