File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ public class ResizableBuffer<T>
16
16
17
17
public ReadOnlyMemory < T > RoMemory => _buffer ;
18
18
19
+ public ref readonly T this [ int idx ] => ref _buffer [ idx ] ;
20
+
19
21
public ResizableBuffer ( int initialCapacity = 8 )
20
22
{
21
23
_initialCapacity = initialCapacity ;
Original file line number Diff line number Diff line change @@ -29,12 +29,12 @@ public void Clear()
29
29
30
30
public T Pop ( )
31
31
{
32
- var item = _buffer . RoSpan [ -- _buffer . CurrentSize ] ;
32
+ var item = _buffer [ -- _buffer . CurrentSize ] ;
33
33
_buffer . Span [ _buffer . CurrentSize ] = default ! ;
34
34
return item ;
35
35
}
36
36
37
- public T Peek ( ) => _buffer . RoSpan [ _buffer . CurrentSize - 1 ] ;
37
+ public T Peek ( ) => _buffer [ _buffer . CurrentSize - 1 ] ;
38
38
39
- public T Peek ( int offset ) => _buffer . RoSpan [ _buffer . CurrentSize - 1 - offset ] ;
39
+ public T Peek ( int offset ) => _buffer [ _buffer . CurrentSize - 1 - offset ] ;
40
40
}
You can’t perform that action at this time.
0 commit comments