Algorithm: Make transform work with simple iterators

Do not require containers to provide a size() method. This
makes for a less optimized insertion into the target container,
but most Qt classes should still handle this ok.

The upside is that e.g. the treemodel iterators can now be
transformed.

Change-Id: I4f149720631d9efb7b787332f039074b4c796965
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-10-21 14:45:50 +02:00
parent a0269d8b27
commit 1ffd78bbf5

View File

@@ -263,7 +263,6 @@ struct TransformImpl {
static C call(const SC &container, F function)
{
C result;
result.reserve(container.size());
std::transform(container.begin(), container.end(),
inserter(result),
function);