std::counte...::operator=(3)
π NAME π
okay bestie, this is std::counte...::operator=(3) from the C++ Standard Libary manual β yes, the header spells it like that, and honestly? iconic typo behavior π.
std::counted_iterator::operator= β std::counted_iterator::operator= (that's literally the whole name, periodt β¨).
πΈ Synopsis πΈ
Here's the signature, bestie β C++20 core, with a lil requires clause doing its vibe check:
template< class I2 >
requires std::assignable_from<I&, const I2&>
(since C++20)
constexpr counted_iterator& operator=( const counted_iterator<I2>&
other );
The underlying iterator and length are assigned with those of other π«Ά.
π Parameters π
otherβ iterator adaptor to assign from π .
π«Ά Return value π«Ά
*this β it returns itself, main character energy fr fr π.
π₯ Example π₯
Run this code, bestie:
// Run this code
#include <algorithm>
#include <cassert>
#include <initializer_list>
#include <iterator>
int main()
{
auto a = {3, 1, 4, 1, 5, 9, 2};
std::counted_iterator<std::initializer_list<int>::iterator>
p(begin(a), size(a) - 2);
std::counted_iterator<std::initializer_list<int>::iterator> q;
assert(q.count() == 0);
assert(q.count() != p.count());
q = p;
assert(q.count() == p.count());
assert(std::ranges::equal(p, std::default_sentinel, q,
std::default_sentinel));
}
π See also π
- constructor β constructs a new iterator adaptor (C++20) (public member function) π¦
okay that's the whole page, bestie π«Ά. It's from http://cppreference.com, dated 2024.06.10, and the page is std::counte...::operator=(3) β go assign some 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