Skip to content

Commit c45e4c6

Browse files
Update introduction.md - change .append() to push_back() (#1044)
Changed result.append(original[rindex]) to result.push_back(original[rindex]) in Approach:Iterative code. .append() does not compile on Exercism, or on Ubuntu using gcc or clang. Appears to be because append() does not work with empty strings.
1 parent e6e47e1 commit c45e4c6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎exercises/practice/reverse-string/.approaches/introduction.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ std::string reverse_string(const std::string& original)
2929
std::size_t rindex = size(original) - i - 1;
3030

3131
// append each character (starting with the last one)
32-
result.append(original[rindex]);
32+
result.push_back(original[rindex]);
3333
}
3434

3535
// result now contains a reversed version of the string

0 commit comments

Comments
 (0)