ClangSharp
ClangSharp copied to clipboard
Expose additional indexers for generated `_e__FixedBuffer` types
ClangSharpPInvokeGenerator will currently only expose an int indexer for its generated _e__FixedBuffer types. This creates an inconsistency with normal fixed buffers, necessitating casts if the field is not able to be emitted as a fixed buffer.
I propose also generating the following indexers:
ref T this[uint index] { get; }
ref T this[nint index] { get; }
ref T this[nuint index] { get; }
This will bring _e__FixedBuffer structures in line with both fixed buffers and the overloads of Unsafe.Add.
I'd say that long term this should be an ask on dotnet/csharplang given that functionality is moving towards InlineArray.
ClangSharp could generate these for compatible codegen, so I'll leave this open and marked as help wanted, but I'm not likely to get to it myself.