One problem you can run into with auto type-deduction is when using auto to deduce the result type of a function.
The solution can be decltype(auto), which, unsurprisingly, follows the decltype rules for determining the type.
Click to open in Compiler Explorer.
Leave a comment