forked from qt-creator/qt-creator
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:
@@ -263,7 +263,6 @@ struct TransformImpl {
|
|||||||
static C call(const SC &container, F function)
|
static C call(const SC &container, F function)
|
||||||
{
|
{
|
||||||
C result;
|
C result;
|
||||||
result.reserve(container.size());
|
|
||||||
std::transform(container.begin(), container.end(),
|
std::transform(container.begin(), container.end(),
|
||||||
inserter(result),
|
inserter(result),
|
||||||
function);
|
function);
|
||||||
|
|||||||
Reference in New Issue
Block a user