Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes in stringImproved #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gcask
Copy link
Contributor

@gcask gcask commented Jul 1, 2021

  • single char variant now calls the string_view counterpart (ensures consistency)
  • fixed the find which was using the stock substr() and not the improved string ones, which has a different behavior (mostly about negative indices).

* single char variant now calls the string_view counterpart (ensures consistency)
* fixed the `find` which was using the stock `substr()` and not the improved string ones, which has a different behavior (mostly about negative indices).
@@ -146,7 +151,7 @@ class string : public std::string
}
bool endswith(char suffix) const
{
return !empty() && (*this)[length()-1] == suffix;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is interesting, because it meant that string{}.endswith("") != string{}.endswith('\0') (the string version assumes an empty string is always present at the end of a string)

@gcask
Copy link
Contributor Author

gcask commented Jul 1, 2021

Note: we should make more stuff use the substr_view() (like endswith!) but that's going to be a separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant