summaryrefslogtreecommitdiffstats
path: root/linker/linked_list.h
diff options
context:
space:
mode:
authorDmitriy Ivanov <dimitry@google.com>2014-09-02 09:45:40 -0700
committerDmitriy Ivanov <dimitry@google.com>2014-09-02 09:45:40 -0700
commita4926058496c1c24c00ac07e42d45048dac7c487 (patch)
tree829a5e199cb60e89ab2f9be1e58281e7d3a9cc39 /linker/linked_list.h
parent5120bcf9f11951bffd8ac595c2b70252ed4a4958 (diff)
downloadbionic-a4926058496c1c24c00ac07e42d45048dac7c487.zip
bionic-a4926058496c1c24c00ac07e42d45048dac7c487.tar.gz
bionic-a4926058496c1c24c00ac07e42d45048dac7c487.tar.bz2
Implement LinkedList::visit()
Change-Id: Ibd9d133dddf1f2e6e65660e3cd2dacafcc0c84d9
Diffstat (limited to 'linker/linked_list.h')
-rw-r--r--linker/linked_list.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/linker/linked_list.h b/linker/linked_list.h
index 14fe1e5..5fbdc8f 100644
--- a/linker/linked_list.h
+++ b/linker/linked_list.h
@@ -86,10 +86,21 @@ class LinkedList {
}
template<typename F>
- void for_each(F&& action) {
+ void for_each(F action) {
+ visit([&] (T* si) {
+ action(si);
+ return true;
+ });
+ }
+
+ template<typename F>
+ bool visit(F action) {
for (LinkedListEntry<T>* e = head_; e != nullptr; e = e->next) {
- action(e->element);
+ if (!action(e->element)) {
+ return false;
+ }
}
+ return true;
}
template<typename F>