C++ 23 · Classes, memory and templates

Write a function template

One function that works for any type that supports >.

template <typename T>
T max_of(T a, T b) {
    return a > b ? a : b;
}

Official C++ 23 documentation

More classes, memory and templates commands

All classes, memory and templates commands · C++ 23 cheatsheet

Was this page helpful?