Skip to content

Where possible, QList member functions should be marked with const #16

Description

@aatwo

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions