Skip to content

Commit

Permalink
Fixed 6.29
Browse files Browse the repository at this point in the history
Signed-off-by: pezy <[email protected]>
  • Loading branch information
pezy committed May 11, 2016
1 parent 69b3d2f commit 5dec1e1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ch06/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,14 @@ The type of `elem` in the `for` loop is `const std::string&`.

## Exercise 6.29

We should use `const reference` as the loop control variable. because the elements in an `initializer_list` are always const values, so we cannot change the value of an element in an `initializer_list`.
Depends on the type of elements of `initializer_list`. When the type is [PODType](http://en.cppreference.com/w/cpp/concept/PODType), reference is unnecessary. Because `POD` is **cheap to copy**(such as `int`). Otherwise, Using reference(`const`) is the better choice.

## Exercise 6.30

Error (Clang):
>Non-void function 'str_subrange' should return a value. // error #1

>Control may reach end of non-void function. // error #2
## Exercise 6.31
Expand Down Expand Up @@ -305,12 +306,12 @@ It isn't a good use of `assert`. The `assert` macro is often used to check for c
candidate function:
>Set of functions that are considered when resolving a function call. (all the functions
with the name used in the call for which a declaration is in scope at the time of the call.)
>with the name used in the call for which a declaration is in scope at the time of the call.)
viable function:
>Subset of the candidate functions that could match a given call.
>It have the same number of parameters as arguments to the call,
and each argument type can be converted to the corresponding parameter type.
>and each argument type can be converted to the corresponding parameter type.
## Exercise 6.50
Expand Down

0 comments on commit 5dec1e1

Please sign in to comment.