Commit 68182044 authored by knowledge4igor's avatar knowledge4igor

Code style improvement

parent 9c2a3c1b
...@@ -113,25 +113,27 @@ namespace std { ...@@ -113,25 +113,27 @@ namespace std {
} }
size_type rfind(string_view v, size_type pos = npos) const noexcept { size_type rfind(string_view v, size_type pos = npos) const noexcept {
if (v.size_ <= size_) { if (v.size_ > size_)
if (pos > size_) return npos;
pos = size_;
size_t start = size_ - v.size_; if (pos > size_)
if (pos != npos) pos = size_;
start = pos; size_t start = size_ - v.size_;
for (size_t offset = 0; offset <= pos; ++offset, --start) { if (pos != npos)
bool found = true; start = pos;
for (size_t j = 0; j < v.size_; ++j) { for (size_t offset = 0; offset <= pos; ++offset, --start) {
if (data_[start + j] != v.data_[j]) { bool found = true;
found = false; for (size_t j = 0; j < v.size_; ++j) {
break; if (data_[start + j] != v.data_[j]) {
} found = false;
} break;
if (found) {
return start;
} }
} }
if (found) {
return start;
}
} }
return npos; return npos;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment