R
Rui Maciel
Andreas said:AFAIK the Qt containers originated from a time when use of the STL
was pretty much ``at your own risk'' and its cross-platform usability
was so pathetic it was far easier to write and maintain your own than
deal with its drama.
That's at least the official justification which I've heard since I first
heard of Qt. Another reason which was frequently pointed out was that
Trolltech was desperately avoiding templates.
Yet, we must bear in mind that Qt has underwent a few rewrites, the last
major one in 2005[1]. I don't believe that in 2005 support for the STL
was "pathetic". Moreover, in 2005 Trolltech introduced containers which
didn't existed in previous releases of Qt and duplicated STL's components.
It is safe to say that at that time neither issue justified reinventing
the STL. But they did it anyway.
Second, all of the Qt classes you mentioned have
implicit sharing and copy-on-write semantics, which the STL classes
don't have.
Qt's container classes weren't introduced with that in mind[2]. The
reasons which, at the time of release, were given amounted to nothing more
than using a different syntax than the one employed in the STL and other
irrelevant details.
While its use for the generic containers is arguable,
it's without a doubt a huge bonus for QString. Third and foremost of
all: QString is so much more than std::string, the comparison isn't
even funny anymore.
Can you please point out any feature which the QString class is able to
provide but it's impossible to provide with std::string? Bear in mind
that Qt has recently been rewritten from scratch.
The most important thing is not the class itself
but the interfaces the Qt lib provides for this class (and conversely
what interfaces the STL does _not_ provide for std::string)
Bear in mind that Qt has been rewritten from scratch. Therefore,
preserving interfaces wouldn't be an issue.
: filesystem
(i.e. portable unicode filename handling, not the ``implementation-
defined''-crap the standard lib tries to get away with)
Qt handles files through the QFile class. That means that at least it
would be quite possible to handle file names without having to deal
directly with std::string objects.
command line
(same here: unicode-transparent)
That's handled by the QCoreApplication and QApplication classes, among
others. Adding to that, the command line arguments are passed directly as
a car ** object. So, that does not force Qt to implement a std::string
replacement.
a huge zoo of text codecs for the
(rare within Qt-)cases where you have to explicitly deal with character
encodings and so on.
If Qt had to implement that stuff for Qt, what leads you to believe that
having to implement them for the std::string in the first place would
force them to develop a replacement for the std::string class?
In other words: no, QtCore doesn't ``duplicate''
the STL, it fills some huge, gaping holes the STL won't touch (at
least the current one).
If it does, you failed to provide the faintest example that indicates
that.
Rui Maciel
[1] http://dot.kde.org/2005/06/28/trolltech-releases-qt-40
[2] http://doc.trolltech.com/4.0/qt4-tulip.html