By the requeriments specified by the std::input_iterator
concept, (and supperior iterators seems to be the same), they have to provide copy and move constructors:
input_iter<T>(const input_iter<T>& other) = default;
input_iter<T>(input_iter<T>&& other) noexcept = default;
Can they be defaulted? The typical implementation contains a private member pointing to some data:
private:
T* data;
Is in iterators a shallow copy/move the desired behaviour? I mean, copy/move the pointer itself, or must implement an explicit deep copy?
CodePudding user response:
Iterators don't own the pointed object, they just point to it. So copying whatever member pointers suffices.