On Sunday, 13 June 2021 09:20:31 PDT Kevin André wrote:
> I have the following piece of code:
> 
>     QVector<int> CompatibilityInterfaceImpl::getActionIds() const
>     {
>         return _actions.keys().toVector();   // _actions is a QHash
>     }
> 
> In Qt Creator this generates the following warning:
>    allocating an unneeded temporary container [clazy-container-anti-pattern]
> 
> How can I avoid the warning in this case?

Create the QVector container, reserve the proper size, and then iterate over 
the actions hashing table inserting the keys.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering



_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to