Skip to content

Commit

Permalink
Update ex3_8.cpp
Browse files Browse the repository at this point in the history
Is it better to define the type of i to decltype(str.size()) rather than int?
  • Loading branch information
Aifeng1214 committed Dec 30, 2015
1 parent da92b19 commit 175a47f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ch03/ex3_8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ int main()
string str("a simple string");

// while
int i = 0;
decltype(str.size()) i = 0;
while (i < str.size()) str[i++] = 'X';
cout << str << endl;

Expand Down

0 comments on commit 175a47f

Please sign in to comment.