| 324 | */ |
| 325 | template <typename L, typename V = L::iterator::value_type, std::invocable<V> F> |
| 326 | bool linked_list_remove(L *list, F matches) { |
| 327 | auto matches_wrapper = [&](L::iterator::value_type item) { |
| 328 | return item && matches(item); |
| 329 | }; |
| 330 | typename L::const_iterator it = std::find_if(list->cbegin(), list->cend(), matches_wrapper); |
| 331 | if (it == list->cend()) |
| 332 | return false; |
| 333 | auto item = *it; |
| 334 | list->erase(it); |
| 335 | delete item; |
| 336 | return true; |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * Returns true if the item with id idToRemove was found, deleted, and |