Skip to content

Commit

Permalink
chang answer Excercise 16.37
Browse files Browse the repository at this point in the history
  • Loading branch information
zhqu1148980644 authored Mar 17, 2019
1 parent d0e3788 commit 4c1316c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ch16/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,12 @@ Then, the answers:
> The library `max` function has two function parameters and returns the larger of its arguments. This function has one template type parameter. Could you call `max` passing it an int and a double? If so, how? If not, why not?
No, I could not. Because the arguments to `max` must have the same type.
Yes. Specify the parameter explicitly:
> ```cpp
> int a = 6; double b = 6.1231;
> max<long double>(a, b);
> ```
> Normal conversions also apply for arguments whose template type parameter is explicitly specified
## Exercise 16.38
Expand Down Expand Up @@ -429,4 +434,4 @@ Since C++11, [`std::allocator::construct`](http://en.cppreference.com/w/cpp/memo
> Write your own version of the flip function and test it by calling functions that have lvalue and rvalue reference parameters.
[flip and test](ex16_47_flip.cpp)
[flip and test](ex16_47_flip.cpp)

0 comments on commit 4c1316c

Please sign in to comment.