std::counted_iterator<I>::operator=
From cppreference.com
 
 
 < cpp | iterator | counted iterator 
 
 
 C++ 
 Feature test macros (C++20)
 Concepts library (C++20)
 Metaprogramming library (C++11)
 Ranges library (C++20)
 Filesystem library (C++17)
 Concurrency support library (C++11)
 Execution control library (C++26)
Iterator library 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
   
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
 
  
 
 
 
 
 
  
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)(C++20)(C++23)(C++20)(C++20)
(deprecated in C++17)
(C++20)
(C++20)
(C++20)(C++20)
  (C++20)
(C++20)
(C++20)
(C++20)
(C++14)
(C++11)
(C++11)
(C++20)(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++23)
(C++23)
(C++23)
(C++23)
(C++23)
(C++11)(C++14)
(C++14)(C++14)
  std::counted_iterator 
 
 
 
 
 
 
 
 
counted_iterator::operator=
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
template< class I2 >
 
 (since C++20) 
    requires std::assignable_from <I&, const I2&>
The underlying iterator and length are assigned with those of other.
Contents
[edit] Parameters
 other
 -
 iterator adaptor to assign from
[edit] Return value
*this
[edit] Example
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 )); }