Skip to content

Deduplicate parts of code between basic_string and basic_string_view #36

@qookei

Description

@qookei

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions