Skip to content

Commit

Permalink
tiny helper to get the topmost element
Browse files Browse the repository at this point in the history
  • Loading branch information
akiraveliara committed Aug 22, 2024
1 parent ceabac7 commit c6212e3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Bundles/ValueCollections/ValueAppendList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public partial record struct ValueAppendList<T> : IDisposable
/// </summary>
public readonly int Count => this.index + 1;

public readonly ref readonly T GetNewestElement()
=> ref this.buffer[this.index];

/// <summary>
/// Adds an element to the list, returning a readonly reference to the newly added element.
/// </summary>
Expand Down

0 comments on commit c6212e3

Please sign in to comment.