[Interest] QList operator[]

Mark Gaiser markg85 at gmail.com
Fri Jan 9 21:13:52 CET 2015


On Fri, Jan 9, 2015 at 7:07 PM, Thiago Macieira <thiago.macieira at intel.com>
wrote:

> On Friday 09 January 2015 17:42:02 Brad Pepers wrote:
> >  So it seems like even though I'm getting a const reference using
> operator
> > [] on the QList, it's actually making a deep copy of the data as if I was
> > using the non-const version.
>
> "I'm getting a const reference using operator[]" is the wrong part.
>
> You're getting a non-const reference using that operator.
>
> Why is that?
QList can return a const & with the [] operator [1]. The documantation even
says it's the same as .at().

[1] http://doc.qt.io/qt-5/qlist.html#operator-5b-5d-2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150109/a8ca3960/attachment.html>


More information about the Interest mailing list