Skip to content

Commit

Permalink
Add Builder AddRange from ReadOnlySpan
Browse files Browse the repository at this point in the history
  • Loading branch information
andreise committed Aug 24, 2023
1 parent 045b9e3 commit dec2e9f
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace System;

partial struct FlatArray<T>
{
partial class Builder
{
// TODO: Add the tests and make public
internal Builder AddRange(ReadOnlySpan<T> items)
{
if (items.IsEmpty)
{
return this;
}

InnerBufferHelperEx.EnsureBufferCapacity(ref this.items, length, items.Length);
items.CopyTo(new Span<T>(this.items, length, items.Length));
length += items.Length;

return this;
}
}
}

0 comments on commit dec2e9f

Please sign in to comment.