[Qgis-developer] STL vs. Qt containers
Martin Dobias
wonder.sk at gmail.com
Fri Oct 27 06:05:14 EDT 2006
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
More information about the Qgis-developer
mailing list