Unrevert two changes

* Sorted Delete for TArray
* Typed constructor for TObjPtr
This commit is contained in:
Ricardo Luís Vaz Silva 2024-03-15 17:19:02 -03:00
parent 0092aa0772
commit cc88dfbe50
2 changed files with 32 additions and 0 deletions

View file

@ -215,6 +215,9 @@ class TObjPtr
mutable DObject *o;
};
public:
TObjPtr() = default;
TObjPtr(T t) : pp(t) {}
constexpr TObjPtr<T>& operator=(T q) noexcept
{

View file

@ -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)