Lexicographically compare this string reference to other.
| 408 | |
| 409 | // Lexicographically compare this string reference to other. |
| 410 | int compare(basic_string_view other) const { |
| 411 | size_t str_size = size_ < other.size_ ? size_ : other.size_; |
| 412 | int result = std::char_traits<Char>::compare(data_, other.data_, str_size); |
| 413 | if (result == 0) |
| 414 | result = size_ == other.size_ ? 0 : (size_ < other.size_ ? -1 : 1); |
| 415 | return result; |
| 416 | } |
| 417 | |
| 418 | friend bool operator==(basic_string_view lhs, basic_string_view rhs) { |
| 419 | return lhs.compare(rhs) == 0; |
no outgoing calls
no test coverage detected