Skip to main content

Practice ยท 1 of 2

Function template: max_of

Implement template <typename T> const T& max_of(const T& a, const T& b) returning a const reference to the larger element (ties: return either โ€” b is fine). It must instantiate for int, double, and std::string alike.

Difficulty: intermediate

Back to lesson: Practice: Function template practice