Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I started by using std::(w)string and the STL containers exclusively and converting to/from the Qt equivalents, but I have already switched to QString and I find that I'm using Qt's containers more and more.</p> <p>When it comes to strings, QString offers much more complete functionality compared to std::basic_string and it is completely unicode aware. It also offers an <a href="http://blog.qt.io/blog/2006/10/16/atomic-reference-counting-is-it-worth-it-2/" rel="noreferrer">efficient COW implementation</a>, which I've come to rely on heavily.</p> <p>Qt's containers: </p> <ul> <li>offer the same COW implementation as in QString, which is extremely useful when it comes to using Qt's foreach macro (which does a copy) and when using metatypes or signals and slots.</li> <li>can use STL-style iterators or Java-style iterators</li> <li>are streamable with QDataStream</li> <li>are used extensively in Qt's API</li> <li>have a stable implementation accross operating systems. A STL implementation must obey the C++ standard, but is otherwise free to do as it pleases (see the std::string COW controversy). Some STL implementations are especially bad.</li> <li>provide hashes, which are not available unless you use TR1</li> </ul> <p>The QTL has a different philosophy from the STL, which is <a href="https://doc.qt.io/archives/qq/qq19-containers.html" rel="noreferrer">well summarized</a> by J. Blanchette: "Whereas STL's containers are optimized for raw speed, Qt's container classes have been carefully designed to provide convenience, minimal memory usage, and minimal code expansion."<br> The above link provides more details about the implementation of the QTL and what optimizations are used.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload