added STL compatible access functions to TArray.

This allows using them in templates made for STL containers.
This commit is contained in:
Christoph Oelckers 2023-12-10 08:58:11 +01:00
commit 41573df58f
3 changed files with 42 additions and 6 deletions

View file

@ -657,6 +657,44 @@ public:
std::swap(Most, other.Most);
}
// aliases with STL compliant names to allow using TArrays with templates designed for STL containers
size_t size() const
{
return Count;
}
T* data() const
{
return Data();
}
T& front() const
{
return *Data();
}
T& back() const
{
return Last();
}
void resize(size_t i)
{
Resize(i);
}
void push_back(T& elem)
{
Push(elem);
}
void clear()
{
Clear();
}
private:
T *Array;
unsigned int Count;