[Qgis-developer] STL vs. Qt containers

Gavin Macaulay g.macaulay at niwa.co.nz
Fri Oct 27 07:07:29 EDT 2006


Hi,

Yea, it's a matter of taste. I like the 'sparseness' and well thought
through nature of STL over the somewhat haphazard nature of the Qt classes
methods, but in the end Qgis uses Qt, with real benefits (i18n with
QString and the file handling classes being two good examples).

It's oh so tempting to get into a discussion over the finer details of
where Qt or STL is better, etc, but as you note that's not really the
point of your original question :)

Gavin

> On 10/27/06, Gavin Macaulay <g.macaulay at niwa.co.nz> wrote:
>> Hi,
>>
>> I prefer the STL containers. I find them to have a more consistent
>> interface than the Qt ones, although with Qt4 most, if not all, of the
>> containers work with STL algorithms and have STL-like functions.
>
> This might be a matter of taste. What do you think is more consistent in
> STL?
> When I compare the usage of containers between Qt and STL, Qt ones can
> have much nicer syntax.
>
> -- STL --
>
> std::list<int> lst;
> ...
> std::list<int>::iterator it;
> for (it = lst.begin(); it != lst.end(); it++)
> {
>   std:: cout << *it << std::endl;
> }
>
> -- Qt --
>
> QList<int> lst;
> ...
> QListIterator<int> it( lst );
> while ( it.hasNext() )
> {
>   std::cout << it.next() << std::endl;
> }
>
>
> But my primary idea is to decide which type of containers to adapt (or
> at least which type for public API), because now we use both STL and
> Qt containers and this mixture makes the QGIS API quite inconsistent.
>
> Martin
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.qgis.org
> http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer
>





More information about the Qgis-developer mailing list