Bug 431789

Summary: False positive with -clazy-inefficient-qlist
Product: [Developer tools] clazy Reporter: Roman <dismine>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Roman 2021-01-18 16:36:31 UTC
Clazy shows an error about inefficient use of QList in the case of QList<T> QMap::values() method.


STEPS TO REPRODUCE
1. Call QList<T> QMap::values() for type with size 16 bytes. 

Because there is no values() method with QVector it should probably skip this case.
Comment 1 Sergio Martins 2021-02-07 13:12:35 UTC
Calling values QMap::values() just makes it worse, as it allocates a temporary container, see README-container-anti-pattern.md.

Ofc, people will always find cases where "but here it's useful for me!", for that reason, inefficient-qlist is disabled by default, and there's inefficient-qlist-soft.

Anyway, no point on spending our weekend around this since it's already a non-issue in Qt 6, where this check doesn't make sense anymore. Any effort spend here will be wasted in the long run.