Review Request 127211: Properly use static QMaps

Sergio Martins smartins at kde.org
Mon Feb 29 10:42:27 UTC 2016



> On Feb. 29, 2016, 10:36 a.m., Milian Wolff wrote:
> > even better would be to use
> > 
> >     static const QHash<QString, ...> map = {
> >         {QStringLiteral(...), value}, // NOTE: don't use QLatin1String here!
> >         ...
> >     };
> >     return map[mapCommand];

QStringLiteral here would break msvc2012, afaik


- Sergio


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


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/cd56361d/attachment.html>


More information about the Kde-frameworks-devel mailing list