D7879: [KConfigGroup] reserve() more and add some C++11
Milian Wolff
noreply at phabricator.kde.org
Tue Sep 19 15:22:04 UTC 2017
mwolff requested changes to this revision.
mwolff added a comment.
This revision now requires changes to proceed.
it would probably be a good idea to rewrite `KConfigGroupPrivate::serializeList` to not take a `QVariantList`, but rather to use a streaming API. I.e. instead of:
void foo(myList)
{
varList = convertList(myList);
write(KConfigGroupPrivate::serializeList(list));
}
Do something like:
void foo(myList)
{
var value = KConfigGroupPrivate::serializeList(mylist)
write(value);
}
where `serializeList` is a template that does $magic internally to convert a list of values to a serializeable format (i.e. iterate over values, then stream them into QDataStream/QTextStream, wrap in QVariant only when needed). Note that you can then use `initializer_list` for the "static" lists like for `QPoint` et al.
INLINE COMMENTS
> kconfiggroup.cpp:185
>
> static QList<int> asIntList(const QByteArray &string)
> {
can you make this (and the `QList<qreal>` below) a `QVector` instead? Would save 50% of memory on 64bit machines
> kconfiggroup.cpp:187
> {
> + const auto &splitString = string.split(',');
> +
use `splitRef` instead, also below
REPOSITORY
R237 KConfig
REVISION DETAIL
https://phabricator.kde.org/D7879
To: broulik, kde-frameworks-devel, dfaure, davidedmundson, mwolff
Cc: mwolff, #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170919/688cde96/attachment.html>
More information about the Kde-frameworks-devel
mailing list