@@ -61,7 +61,8 @@ class Deque
61
61
* item->mMe of the match or NULL if no match.
62
62
* Mutation of the list during fn() should be avoided
63
63
*/
64
- T * Find (std::function<bool (T *)> fn)
64
+ template <typename Functor>
65
+ T * Find (Functor fn)
65
66
{
66
67
Deque * next = nullptr ;
67
68
for (Deque * item = this ; next != this ; item = next)
@@ -87,7 +88,8 @@ class Deque
87
88
* item->mMe of the match or NULL if no match.
88
89
* Mutation of the list during fn() should be avoided
89
90
*/
90
- T * FindR (std::function<bool (T *)> fn)
91
+ template <typename Functor>
92
+ T * FindR (Functor fn)
91
93
{
92
94
Deque * prev = nullptr ;
93
95
for (Deque * item = mPrev ; prev != mPrev ; item = prev)
@@ -110,7 +112,8 @@ class Deque
110
112
* this item.
111
113
* Mutation of the list during fn() should be avoided
112
114
*/
113
- void Foreach (std::function<void (T *)> fn)
115
+ template <typename Functor>
116
+ void Foreach (Functor fn)
114
117
{
115
118
Deque * next = nullptr ;
116
119
for (Deque * item = this ; next != this ; item = next)
@@ -129,7 +132,8 @@ class Deque
129
132
* the last item
130
133
* Mutation of the list during fn() should be avoided
131
134
*/
132
- void ForeachR (std::function<void (T *)> fn)
135
+ template <typename Functor>
136
+ void ForeachR (Functor fn)
133
137
{
134
138
Deque * prev = nullptr ;
135
139
for (Deque * item = mPrev ; prev != mPrev ; item = prev)
0 commit comments