[Qt-interest] what is wrong with this Complex Data Structure
Andre Somers
andre at familiesomers.nl
Tue May 11 10:29:33 CEST 2010
On 11-5-2010 10:22, Meir Yanovich wrote:
> i guess i need glasses , and more coffee
> sorry
> ):
> Thanks
Small tip:
use typedefs for such nested template types. Makes it much easier to
read and write your code in the end.
So, instead of writing
QMap<QString,QList<QMap<QString,QString > > > ResultMap;
QList<QMap<QString,QString > > result_set;
you could write something like:
//somewhere in a header
typedef Result QMap<QString, QString>;
typedef ResultList QList<Result>;
typedef ResultListMap QMap<QString, ResultList>;
//in your source;
ResultListMap resultMap;
ResultList resultList;
for(int i = 3;i<3;i++)
{
Result result("www","wwwww");
resultList.append(result);
}
This also makes passing these things in functions much more readable.
André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100511/917ad27a/attachment.html
More information about the Qt-interest-old
mailing list