Open katsusan opened 3 years ago
refer: https://docs.google.com/document/d/1GKKdiGYAghXRxC2BFrSEbHBZZgAGKQ-yXK-hRKBo0Kk/pub
int cap; int len; T *array;
which means slice should be stored as the following layout:
s[i:j:k] constructs a slice, means len=j-i, cap=k-i, starting at s[i], and must satisfy i<=j<=k<=cap(s).
x := make([]int, 5, 10) //valid x[i:j:k] x[:j:k] //invalid x[i::] x[:j:] x[::k] x[i::k] x[i:j:]
refer: https://docs.google.com/document/d/1GKKdiGYAghXRxC2BFrSEbHBZZgAGKQ-yXK-hRKBo0Kk/pub
1. slice struct
which means slice should be stored as the following layout:
2. three-index slice definition
s[i:j:k] constructs a slice, means len=j-i, cap=k-i, starting at s[i], and must satisfy i<=j<=k<=cap(s).
3. defaults