Details
-
Suggestion
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
None
Description
Functions like:
bool exactMatch(const QString &str) const;
int indexIn(const QString &str, int offset = 0, CaretMode caretMode = CaretAtZero) const;
int lastIndexIn(const QString &str, int offset = -1, CaretMode caretMode = CaretAtZero) const;
Are const in QRegExp, leading one to erroneous code that accesses the same QRegExp object in different threads. If they were non-const, the user would be forced to create a copy per-thread.
Another argument: those functions do modify the state of QRegExp because you can get the captured text information after trying to match.