The text on p. 159 states, "...if a template function's return type is a template argument, you must specify template arguments explicitly."
In Listing 6-13, the function mean returns type T, a template argument. Yet in main(), the calls to mean do not specify any template arguments. The listing compiles and runs correctly, so the text contains either an error or an ambiguity in the use of the phrase "template argument."
The text was updated successfully, but these errors were encountered:
Thanks @tcflanagan! I see how this could be very confusing. I've added the qualifier "if a template function’s return type is a template argument that's entirely independent of other function and template arguments"
tcflanagan commentedJan 1, 2020
The text on p. 159 states, "...if a template function's return type is a template argument, you must specify template arguments explicitly."
In Listing 6-13, the function
mean
returns typeT
, a template argument. Yet inmain()
, the calls tomean
do not specify any template arguments. The listing compiles and runs correctly, so the text contains either an error or an ambiguity in the use of the phrase "template argument."The text was updated successfully, but these errors were encountered: