Op 21/03/2017 om 16:55 schreef Thiago Macieira: > Em terça-feira, 21 de março de 2017, às 05:22:31 PDT, André Somers escreveu: >> Op 20/03/2017 om 23:43 schreef Kevin Kofler: >>> Marc Mutz wrote: >>>> https://github.com/KDE/libkleo/blob/2fe48b77ba61fada80eaace8cb71dd0fd1326 >>>> 5ae/src/kleo/stl_util.h> >>> Thanks for proving my point that the STL APIs require tons of copy&paste >>> boilerplate in every project. >> That's not just your point, it's Stephanovs point as well. The STL is a >> starting point, a good, well-tested set of basic building blocks. Nobody >> claimed it contains any and all containers or algoritms you'd ever need. >> In fact, in its first form it contained more, but large parts of it got >> backed out before standardization. Surely you don't expect Qt to supply >> every container type and every algorithm possible? > Not all, but a good set of algorithms that are in common use. Getting all > keys > and values is common, even if sometimes you leading to bad code. > Don't we have keyBegin and keyEnd for getting the keys? (No direct equivalent for values, it seems...):
QVector<MyKeyType> keys; keys.reserve(theHash.size()); std::copy(theHash.keyBegin(), theHash.keyEnd(), std::back_inserter(keys)); Sure, it is longer than auto keys = theHash.keys(); but it does not bind you to using a container selected by Qt to return the keys in. If you need them in a vector, you can put them in a vector. If you want them in a set, you can put them in a set. André _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development