Skip to content

Commit

Permalink
weakened size assumption
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobiasd committed Apr 11, 2014
1 parent 43cedc7 commit fe477df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion from_goto_to_std-transform.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ vector<int> squareVec6(const vector<int>& v)
return result;
}
```
`std::transform` tells the reader at one glance that `result` will have the same size as `v` and that every single element from `v` will be used to generate exactly one element for `result`.
`std::transform` tells the reader at one glance that `v.size()` elements will be pushed into `result` and that every single element from `v` will be used to generate exactly one new element for `result`.
Now one just has to look at `return i*i` and he directly knows everything.
This is much easier than to decypher a for loop every time.

Expand Down

0 comments on commit fe477df

Please sign in to comment.