std::experi...last_not_of(3)
π
std::experimental::basic_string_view::find_last_not_of
okay bestie, buckle up β this one's from the C++ Standard Library section, and the page you're on is std::experi...last_not_of(3) (yes the header truncates it, that's just how it's filed, we don't make the rules). It's a member of std::experimental::basic_string_view, and it's giving "find me the last character that is not in this club" energy. Let's go π¦
β¨ SYNOPSIS β¨
All four of these are library fundamentals TS β like, they're the experimental ones, iykyk π§ͺ
constexpr size_type
find_last_not_of(basic_string_view v, size_type pos = npos) const noexcept; // (1)
constexpr size_type
find_last_not_of(CharT c, size_type pos = npos) const noexcept; // (2)
constexpr size_type
find_last_not_of(const CharT* s, size_type pos, size_type count) const; // (3)
constexpr size_type
find_last_not_of(const CharT* s, size_type pos = npos) const; // (4)
quick vibe check: (1) and (2) are noexcept β (3) and (4) are not. noted. π«Ά
π WHAT IT DOES π
Finds the last character not equal to any of the characters in the given character sequence. Basically: "walk backwards till you find someone who isn't on the list, bestie." π
Here's the breakdown, overload by overload:
- Finds the last character not equal to any of the characters of
vin this view, starting at positionpos. - Equivalent to
find_last_not_of(basic_string_view(&c, 1), pos). - Equivalent to
find_last_not_of(basic_string_view(s, count), pos). - Equivalent to
find_last_not_of(basic_string_view(s), pos).
literally a family of four little icons doing the exact same quest with different starting gear π
πΈ PARAMETERS πΈ
vβ view to search forposβ position at which to start the searchcountβ length of the string of characters to comparesβ pointer to a string of characters to comparechβ character to compare
(yeah the parameter list says ch and the synopsis says CharT c β that's the manpage being its authentic self, don't come for me π)
β RETURN VALUE β
Position of the last character not equal to any of the characters in the given string, or npos if no such character is found.
π¨ translation: if every character is on the list and nobody's an outsider, you get npos. that's the "no thoughts, head empty, not found" result, bestie.
π₯ COMPLEXITY π₯
O(size() * v.size()) at worst.
so likeβ¦ the worst case is doing the whole comparison thing for every position. it's not the speediest icon at the party but she gets there π
π SEE ALSO π
findβ find characters in the view (public member function)rfindβ find the last occurrence of a substring (public member function)find_first_ofβ find first occurrence of characters (public member function)find_last_ofβ find last occurrence of characters (public member function)find_first_not_ofβ find first absence of characters (public member function)
the whole find family is iconic, honestly π
π Category
- Noindexed pages
(that's it. that's the category. no note added. we respect the metadata.) π
and that's the whole page, bestie β every overload, every parameter, every default, nothing skipped, periodt π
source/version + date, as promised: this came from http://cppreference.com, dated 2024.06.10. go drink some water and go find your last-not-of character, you absolute main character π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms