42 lines
1.3 KiB
C++
42 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "tl/detail/prologue.h"
|
|
#include "tl/algorithm.h"
|
|
|
|
namespace tl
|
|
{
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
template <typename Container, typename T>
|
|
auto remove(Container& container, const T& value) noexcept -> decltype(container.begin())
|
|
{
|
|
return eastl::remove(container.begin(), container.end(), value);
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
template <typename Container, typename UnaryPredicate>
|
|
auto remove_if(Container& container, const UnaryPredicate& predicate) noexcept -> decltype(container.begin())
|
|
{
|
|
return eastl::remove_if(container.begin(), container.end(), predicate);
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
template <typename Container, typename T>
|
|
auto erase(Container& container, const T& value) noexcept -> decltype(container.begin())
|
|
{
|
|
return container.erase(remove(container, value), container.end());
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
template <typename Container, typename UnaryPredicate>
|
|
auto erase_if(Container& container, const UnaryPredicate& predicate) noexcept -> decltype(container.begin())
|
|
{
|
|
return container.erase(remove_if(container, predicate), container.end());
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
}
|