A standard struct cannot contain a view struct field.
A view struct is a special type of struct designed for transient data access.
- strictly limited to the stack
- a
view structcan only be a field within anotherview struct - cannot be used as a generic argument by default
- cannot be used with
using, haveusingfields and destructor
view struct Span<T>
{
view T _ptr;
int _length;
public Span(view T ptr, int length)
{
_ptr = ptr;
_length = length;
}
}