std::regex_...,operator!=(3)
π std::regex_...,operator!=(3) β C++ Standard Library, bestie edition
Okay so picture this: it's the std::regex_token_iterator page, and today we're doing its equality operators. Yes, both of them. Sit down, grab a strawberry π, this is actually so much simpler than it looks.
β¨ NAME β¨
std::regex_token_iterator::operator==, operator!= β the twin operators that decide whether two regex token iterators are literally the same vibe or not.
πΈ Synopsis πΈ
bool operator==( const regex_token_iterator& other ) const; (1)
(since C++11)
bool operator!=( const regex_token_iterator& other ) const; (2)
(since C++11)
Heads up: there's an (until C++20) marker hanging out on this page, so keep that in mind for the timeline of these bad boys π
So, what do they actually do? They check whether *this and other are equivalent. That's the whole assignment, no cap.
Two regex token iterators are equal if:
- a) they are both end-of-sequence iterators. Bestie, if you're both at the end, you're the same. Slay.
- b) they are both suffix iterators and the suffixes are equal. Matching suffixes = matching energy β¨
- c) neither of them is an end-of-sequence iterator or a suffix iterator, and:
position == other.positionN == other.Nsubs == other.subs
And then the numbered ones:
- Checks whether
*thisis equal toother. - Checks whether
*thisis not equal toother.
Fun little glow-up era: the != operator is synthesized from operator==. (since C++20) So it's not doing its own thing anymore β it's just riding operator=='s coattails. Iconic behavior, honestly. π¦
β οΈ This section is incomplete Reason: Explain better. For example, subs is an exposition-only vector of matched sub-expressions.
Not me leaving a todo in the docs π but like β at least they're honest about it.
π Parameters π
otherβ another regex token iterator to compare to. That's it. That's the parameter. Go off, king. π«Ά
π Return value π
trueif*thisis equal toother,falseotherwise.trueif*thisis not equal toother,falseotherwise.
No surprises, no plot twists, just good old-fashioned booleans. Periodt. π
π¦ Category π¦
- Todo with reason
And that's the whole page, bestie! π
Signing off with the receipts: this one came from http://cppreference.com, dated 2024.06.10, and it's filed under std::regex_...,operator!=(3). Go forth and compare iterators responsibly β¨π
π¦ 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