Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

initialize QMap with stream operators?

$
0
0
QMap doesn’t seem to have a stream operator defined for easy initialization, like so: template <class Key, class T> QMap<Key, T>& operator<<(QMap<Key, T>& map,                          const QPair<Key, T>& data) {     map.insert(data.first, data.second);     return map; }   // Use: static const QMap<int, QString> someMap =     QMap<int, QString>() << qMakePair(1, QString("One"))                          << qMakePair(2, QString("Two")); Is there a good reason no such operator is defined in Qt?

Viewing all articles
Browse latest Browse all 18427

Trending Articles