| 172 | } |
| 173 | |
| 174 | size_type rfind(const StringPiece& s, size_type pos = npos) const { |
| 175 | if (length_ < s.length_) return npos; |
| 176 | const size_t ulen = length_; |
| 177 | if (s.length_ == 0) return std::min(ulen, pos); |
| 178 | |
| 179 | const char* last = ptr_ + std::min(ulen - s.length_, pos) + s.length_; |
| 180 | const char* result = std::find_end(ptr_, last, s.ptr_, s.ptr_ + s.length_); |
| 181 | return result != last ? result - ptr_ : npos; |
| 182 | } |
| 183 | |
| 184 | size_type rfind(char c, size_type pos = npos) const { |
| 185 | if (length_ == 0) return npos; |
no outgoing calls