...

/

Range Kind Templates

Range Kind Templates

Get introduced to the range kind templates.

We'll cover the following...

We used mostly int ranges in the previous chapter. In practice, containers, algorithms, and ranges are almost always implemented as templates. The print() example was a template as well:

void print(T)(T range) {
    // ...
}

What lacks from the implementation of print() is that even though it requires T to be a kind of InputRange, it does not formalize that requirement with a template constraint.

The ...