Quote Originally Posted by NewLegend View Post
The least number of lines and more accurate.
The number of lines of code is not that relevant, consider the two examples:

Qt Code:
  1. struct one {
  2. };
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. struct two {
  2. two(const QString &_a, const QString &_b) : m_a(_a), m_b(_b){}
  3. void setA(const QString &a) { m_a = a; }
  4. void setB(const QString &b) { m_b = b; }
  5. const QString &a() const { return m_a; }
  6. const QString &b() const { return m_b; }
  7. private:
  8. QString m_a;
  9. QString m_b;
  10. };
To copy to clipboard, switch view to plain text mode 

Which is better? From what point of view? And how about this one?

Qt Code:
  1. struct three_private : public QSharedData {
  2. three_private() : QSharedData(){}
  3. three_private(const three_private &other) : QSharedData(other), a(other.a), b(other.b){}
  4. };
  5.  
  6. class three {
  7. public:
  8. three() : d(new three_private){}
  9. three(const three &other) : d(other.d){}
  10. void setA(const QString &a) { d->a = a; }
  11. void setB(const QString &b) { d->b = b; }
  12. const QString &a() const { return d->a; }
  13. const QString &b() const { return d->b; }
  14. private:
  15. QSharedDataPointer<three_private> d;
  16. };
To copy to clipboard, switch view to plain text mode 

Which is fastest? Which is least error prone? Which is easiest to extend, i.e. by forcing "b" to be lowercase alphanumeric characters only?

There is difficulty in building data structures with qt4. If you use inheritance in data structures.
You can use C structures in Qt-based code as well, if you want and you like to inflict pain on yourself while programming

Edit: Oh, for completeness regarding your code, there is QLinkedList.