The Constrained Template Parameter
Learn how to use the constrained template parameter to write concepts.
We'll cover the following...
How to write constrained template parameters
Constrained template parameters are a bit terser than the ones we’ve discussed so far. They also have some limitations.
template <Number T>
auto add(T a, T b) {
return a+b;
}
As we can see, we don’t need any requires
clause here. We can simply define a requirement on our template parameters ...