Review Request 127211: Properly use static QMaps

Milian Wolff mail at milianw.de
Mon Feb 29 10:36:34 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127211/#review92889
-----------------------------------------------------------


Ship it!




even better would be to use

    static const QHash<QString, ...> map = {
        {QStringLiteral(...), value}, // NOTE: don't use QLatin1String here!
        ...
    };
    return map[mapCommand];

- Milian Wolff


On Feb. 28, 2016, 9:52 p.m., Aleix Pol Gonzalez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127211/
> -----------------------------------------------------------
> 
> (Updated Feb. 28, 2016, 9:52 p.m.)
> 
> 
> Review request for Kate and KDE Frameworks.
> 
> 
> Repository: ktexteditor
> 
> 
> Description
> -------
> 
> Only initialize them once.
> Since they're not const, use ::value rather than ::operator[], because the latter will provide a default-constructed object and add it to the map.
> 
> 
> Diffs
> -----
> 
>   src/vimode/cmds.cpp 7804af4 
> 
> Diff: https://git.reviewboard.kde.org/r/127211/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Aleix Pol Gonzalez
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160229/e97315ea/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list