Re: STL / Qt flame-war (Re: [linux-audio-dev] Audio-related widgets with Qt ?)

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: STL / Qt flame-war (Re: [linux-audio-dev] Audio-related widgets with Qt ?)
From: jelle_AT_defekt.nl
Date: Mon Sep 17 2001 - 18:30:36 EEST


On Mon, Sep 17, 2001 at 05:02:37PM +0200, jelle wrote:

Hope i'm not getting too much off topic

> > > I just want to mention one reason why I don't like using Qt myself,
> > > not as flamebait but just to make it clear. Qt was written before the
> > > Standard Template Library (STL) was reasonably standardized.

Most librarys that omit the STL tell you that it is because of portability
reasons. Is this true, is STL so unportable? It is written in C++ right?
So should it be easy to use the reference STL lib and use it for
whatever platform that has a C++ compiler?

Except for the stream io maybe?

(Ofcourse optimized implementations would have system specific calls)

> > > As a
> > > result, it contains implementations for things like lists, vectors and
> > > many other container classes, that are part of the STL. For similar
> >
> > I guess it depends on what one is used to. I have always found STL totally
> > painful

It really isn't. It's a bit complex at start, probably because of the
template use and the iterators. However, both of there are powerfull
things and you should understand them both anyway (not that hard).

> > , the headers are unreadable

That is because of two reasons.
 a) it is a template
 b) all logic code (that would normally reside in a .cc file) is in the
    header as well since templates cannot be compiled into libraries.

You shouldn't attempt to read the headers, instead buy a book such as
"The C++ Programming Language" by Bjarne himself. It has some intense
chapters on the STL which explain why and how you should use the STL.

Oh, wait, read this document, it's a chapter from the mentioned book,
"Introduction to the standard library"

It's a good starter, however you really need some detailed reference
material to appreciate the STL. The ease of use is in the numerous
specific functions.

> > and some of the most simple operations
> > take enormous amounts of effort (like removing the n:th element from a
> > list).

from pg 454 of "the" book. ;)

 // remove element n from container c:
 c.erase( c.begin()+n ); // ok if iterator supports +

 // or use
 c.erase( c.begin().advance(n) );
 

You see, it's not that hard. :)

cheers

-- 
defekt


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Sep 17 2001 - 17:33:40 EEST