Returns the number of elements in the vector.
Return the exact length of the iterator.
Counts the number of elements in this iterator.
So while they return the same value, count
will actually count the elements. Note that len
is available only for ExactSizeIterator; so if the value is lazy-retrieved the total length may not be available and you need to explicitly count it.