Home
Phabricator
Search
Log In
Paste
P69
Masterwork From Distant Lands
Active
Public
Actions
Authored by
dkazakov
on Feb 10 2017, 1:35 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
diff --git a/libs/global/krita_container_utils.h b/libs/global/krita_container_utils.h
index f303411..6d1ca96 100644
--- a/libs/global/krita_container_utils.h
+++ b/libs/global/krita_container_utils.h
@@ -46,10 +46,11 @@ template <class C>
}
-template <class C>
- void filterContainer(C &container, std::function<bool(typename C::reference)> keepIf) {
+template <class C, typename KeepIfFunction>
+ auto filterContainer(C &container, KeepIfFunction keepIf)
+ -> decltype(bool(keepIf(container[0])), void()) {
- auto newEnd = std::remove_if(container.begin(), container.end(), std::unary_negate<decltype(keepIf)>(keepIf));
+ auto newEnd = std::remove_if(container.begin(), container.end(), [keepIf] (typename C::reference p) { return !keepIf(p); });
while (newEnd != container.end()) {
newEnd = container.erase(newEnd);
}
dkazakov
edited the content of this paste.
(Show Details)
Feb 10 2017, 1:35 PM
dkazakov
changed the title of this paste from untitled to
Masterwork From Distant Lands
.
dkazakov
updated the paste's language from
autodetect
to
autodetect
.
Log In to Comment