Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions include/RED4ext/DynArray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,31 @@ struct DynArray
return *(entries + size - 1);
}

[[nodiscard]] T* Data() noexcept
{
return entries;
}

[[nodiscard]] const T* Data() const noexcept
{
return entries;
}

[[nodiscard]] uint32_t Capacity() const noexcept
{
return capacity;
}

[[nodiscard]] uint32_t Size() const noexcept
{
return size;
}

[[nodiscard]] bool IsEmpty() const noexcept
{
return size == 0;
}

T* entries; // 00
uint32_t capacity; // 08
uint32_t size; // 0C
Expand Down
17 changes: 16 additions & 1 deletion include/RED4ext/Span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct Span

constexpr operator bool() const noexcept
{
return IsEmpty();
return !IsEmpty();
}

T& operator[](size_t aIndex)
Expand Down Expand Up @@ -57,6 +57,21 @@ struct Span
return endPtr - beginPtr;
}

[[nodiscard]] inline T* Data()
{
return beginPtr;
}

[[nodiscard]] inline const T* Data() const
{
return beginPtr;
}

[[nodiscard]] inline auto Size() const
{
return endPtr - beginPtr;
}

T* beginPtr; // 00
T* endPtr; // 08
};
Expand Down