mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 12:11:25 +00:00
Unrevert two changes
* Sorted Delete for TArray * Typed constructor for TObjPtr
This commit is contained in:
parent
0092aa0772
commit
cc88dfbe50
2 changed files with 32 additions and 0 deletions
|
@ -215,6 +215,9 @@ class TObjPtr
|
|||
mutable DObject *o;
|
||||
};
|
||||
public:
|
||||
TObjPtr() = default;
|
||||
|
||||
TObjPtr(T t) : pp(t) {}
|
||||
|
||||
constexpr TObjPtr<T>& operator=(T q) noexcept
|
||||
{
|
||||
|
|
|
@ -576,6 +576,35 @@ public:
|
|||
return f;
|
||||
}
|
||||
|
||||
bool SortedDelete(const T& obj)
|
||||
{
|
||||
auto f = SortedFind(obj, true);
|
||||
if (f == Size())
|
||||
{
|
||||
Delete(f);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Func>
|
||||
bool SortedDelete(const T& obj, Func lt)
|
||||
{
|
||||
auto f = SortedFind(obj, lt, true);
|
||||
if (f == Size())
|
||||
{
|
||||
Delete(f);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Pop ()
|
||||
{
|
||||
if (Count > 0)
|
||||
|
|
Loading…
Reference in a new issue