Commit 4df436f6 authored by Tobias Hunger's avatar Tobias Hunger

Algorithm: Make filtered accept a member function pointer

Change-Id: Ib71da93b3893ffb3309d00d7ce2dc803ff0eb4b4
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent d18b8507
......@@ -349,6 +349,16 @@ C filtered(const C &container, F predicate)
return out;
}
template<typename C, typename R, typename S>
Q_REQUIRED_RESULT
C filtered(const C &container, R (S::*predicate)() const)
{
C out;
std::copy_if(container.begin(), container.end(),
inserter(out), std::mem_fn(predicate));
return out;
}
//////////////////
// sort
/////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment