QList icon indicating copy to clipboard operation
QList copied to clipboard

Where possible, QList member functions should be marked with const

Open aatwo opened this issue 2 years ago • 0 comments

Where possible, QList member functions that do not modify the QList should be marked with const. For example size(), length(). At present, the following simple function prototype will produce a compilation error:

void update(const QList<MyStruct>& myList)
{
  ...
}

The workaround (removing the const qualifier) is unsafe because the update() function can now modify the list.

aatwo avatar Aug 20 '22 20:08 aatwo