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

Deduplicate parts of code between basic_string and basic_string_view #36

Open
qookei opened this issue Jul 2, 2022 · 0 comments · May be fixed by #53
Open

Deduplicate parts of code between basic_string and basic_string_view #36

qookei opened this issue Jul 2, 2022 · 0 comments · May be fixed by #53

Comments

@qookei
Copy link
Member

qookei commented Jul 2, 2022

Certain basic_string operations (such as comparisons) can be implemented in terms of basic_string_view: e.g.:

bool operator==(const basic_string &other) const {
    return basic_string_view<Char>{_buffer, _length} == basic_string_view<Char>{other._buffer, other._length};
}

We could also add a convenience basic_string::view() method that does the view construction.

Doing this will allow us to more easily prevent bugs like the one fixed by 264af2d.

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 a pull request may close this issue.

1 participant