- Exercise

In this lesson, we'll solve an exercise related to the automatic return type.

We'll cover the following

Problem Statement

The two algorithms gcdConditional and gcdCommon, in the given code, use the type-traits library.

  • Study both algorithms.
  • Both algorithms determine their return type at compile-time.

Why is it not possible to use auto or decltype(auto) to automatically deduce the return type?

Get hands-on with 1400+ tech skills courses.