Skip to content

Commit e959db7

Browse files
committed
"For each" is probably a more suitable name than "for all" when the action is called for one element at a time.
1 parent b09a4ff commit e959db7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Source/DFPSR/api/algorithmAPI_List.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ List<OUTPUT_TYPE> list_map(const List<INPUT_TYPE> &input, const TemporaryCallbac
8686
// condition should return true iff the given element should call action,
8787
// action should return true to continue the loop or false when done.
8888
template <typename T, bool BACKWARD = false>
89-
static List<intptr_t> list_forAll(
89+
static List<intptr_t> list_forEach(
9090
const dsr::List<T> &list,
9191
const TemporaryCallback<bool(intptr_t index, const T &element)> &condition,
9292
const TemporaryCallback<bool(intptr_t index, const T &element)> &action
@@ -170,7 +170,7 @@ template <typename T>
170170
static inline List<intptr_t> list_findAll(const dsr::List<T> &list, const TemporaryCallback<bool(intptr_t index, const T &element)> &condition) {
171171
List<intptr_t> result;
172172
// Ascending loop
173-
list_forAll<T, false>(list, condition, [&result](intptr_t index, const T &element) -> bool {
173+
list_forEach<T, false>(list, condition, [&result](intptr_t index, const T &element) -> bool {
174174
result.push(index); // Push the element's index to the list.
175175
return true; // Keep iterating over the list.
176176
});
@@ -192,7 +192,7 @@ template <typename T>
192192
static inline intptr_t list_findFirst(const dsr::List<T> &list, const TemporaryCallback<bool(intptr_t index, const T &element)> &condition) {
193193
intptr_t result = -1;
194194
// Ascending loop
195-
list_forAll<T, false>(list, condition, [&result](intptr_t index, const T &element) -> bool {
195+
list_forEach<T, false>(list, condition, [&result](intptr_t index, const T &element) -> bool {
196196
result = index; // Take the index as the result.
197197
return false; // We are done iterating over the list.
198198
});
@@ -214,7 +214,7 @@ template <typename T>
214214
static inline intptr_t list_findLast(const dsr::List<T> &list, const TemporaryCallback<bool(intptr_t index, const T &element)> &condition) {
215215
intptr_t result = -1;
216216
// Descending loop
217-
list_forAll<T, true>(list, condition, [&result](intptr_t index, const T &element) -> bool {
217+
list_forEach<T, true>(list, condition, [&result](intptr_t index, const T &element) -> bool {
218218
result = index; // Take the index as the result.
219219
return false; // We are done iterating over the list.
220220
});

0 commit comments

Comments
 (0)