Skip to content

Commit

Permalink
Change answer Ex16.42
Browse files Browse the repository at this point in the history
Solution to Excercise 16.42 is uncomplete.
Added explanation.
  • Loading branch information
zhqu1148980644 authored Mar 18, 2019
1 parent d0dd699 commit 35c524d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ch16/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ Yes. Specify the parameter explicitly:
> int a = 6; double b = 6.1231;
> std::cout << std::max<long double>(a, b) << std::endl;
> ```
> Normal conversions also apply for arguments whose template type parameter is explicitly specified
> Normal conversions also apply for arguments whose template type parameter is explicitly specified.
## Exercise 16.38
Expand Down Expand Up @@ -395,9 +395,13 @@ More safer solution: <[Better `sum`](ex16_41_sum.cpp)>
> (c) g(i * ci);
> ```
- (a) `int&`
- (b) `const int&`
- (c) `int`
- (a) T: `int&` val: int& && -> int &
- (b) T: `const int&` val: const int& && -> const int &
- (c) T: `int` val: int &&
> When we pass an lvalue `int` to a function parameter that is an rvalue reference to a template type parameter `T&&`, the compiler deduces the template type parameter as the argument’s lvalue reference type `int &`.
> `X& &`, `X& &&`, and `X&& &` all collapse to type `X&`.
## Exercise 16.43
Expand Down

0 comments on commit 35c524d

Please sign in to comment.