Find the last occurrence of substring s *this, but only those occurrences earlier than position pos.
| 218 | /// Find the last occurrence of substring s *this, but only those |
| 219 | /// occurrences earlier than position pos. |
| 220 | size_type rfind (string_ref s, size_t pos=npos) const { |
| 221 | if (pos > size()) |
| 222 | pos = size(); |
| 223 | const_reverse_iterator b = this->crbegin()+(size()-pos); |
| 224 | const_reverse_iterator e = this->crend(); |
| 225 | const_reverse_iterator i = std::search (b, e, s.crbegin(), s.crend(), traits::eq); |
| 226 | return i == e ? npos : (reverse_distance(this->crbegin(),i) - s.size() + 1); |
| 227 | } |
| 228 | |
| 229 | /// Find the last occurrence of character c in *this, but only those |
| 230 | /// occurrences earlier than position pos. |