Skip to content

Commit 416b8d1

Browse files
committed
ContainerAlgorithms::erase_all_occurrences removed - use std::erase(vec, value)
1 parent d58a24d commit 416b8d1

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

container/algorithms.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ namespace ContainerAlgorithms {
99
// Erases all matching elements from the container
1010
//
1111

12-
template <class ContainerType, typename ArgumentType>
13-
inline void erase_all_occurrences(ContainerType& container, const ArgumentType& item)
14-
{
15-
container.erase(std::remove(container.begin(), container.end(), item), container.end());
16-
}
17-
1812
template <class ContainerType, typename PredicateType>
1913
inline void erase_if(ContainerType& container, PredicateType&& unaryPredicate)
2014
{

utility/callback_caller.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#include "../container/algorithms.hpp"
4-
53
#include <algorithm>
64
#include <assert.h>
75
#include <vector>
@@ -17,7 +15,7 @@ class CallbackCaller {
1715

1816
void removeSubscriber(Interface* instance)
1917
{
20-
ContainerAlgorithms::erase_all_occurrences(_subscribers, instance);
18+
std::erase(_subscribers, instance);
2119
}
2220

2321
template <typename MethodPointer, typename ...Args>

0 commit comments

Comments
 (0)