QList<T>::(const_)iterator both feature an implicit operator T*.
This operator exists in order to keep compatibility with Qt 5 code,
where QVector<T>::iterator _was_ indeed a T*. However, iterators are
not proxy objects and should not convert to T* (at least, not
implictly). In fact we've already seen compilers complain about
ambiguous calls when e.g. moving an iterator through an arithmetic
operation (say, operator+).
For instance, if one does
it + number
and the numeric argument of that call is not precisely qsizetype
(but, say, int), then the call is ambiguous between
operator+(iterator, int promoted to qsizetype)
operator+(pointer (converted from iterator), int)
One can imagine similar failures in generic code. In short: let's
deprecate (not remove) the implicit conversion, and let people use
iterators for what they are.
Task-number: QTBUG-96128
Change-Id: I008348beefe00e4449b2d95c21c842d676390a26
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>