Should core::slice::Iter be Copy?

References like &T are Copy, as are slices like &[T]. So, shouldn't std::slice::Iter also be Copy? It is just a wrapper over a slice.

1 Like

A convention has been established that iterators should preferably not be Copy, since they are stateful and implicit copying makes it easier to make some logic errors related to that. For this reason, those iterators are not Copy and the same reason has been used to not have ranges Copy either.

Even so, it would be convenient in some cases, to have them as Copy.

6 Likes