5 ms·
I think parent was after base+offset+index rather than just base+index. Examples would be eg, `string_view` or `ArraySegment`. They hold some offset relative t
by sparkie 17d ago
I think parent was after base+offset+index rather than just base+index.
Examples would be eg, `string_view` or `ArraySegment`. They hold some offset relative to a base allocation, and when we index the string_view or ArraySegment we're indexing relative to that offset.
- pocksuppet 6d agoThat is called pointer arithmetic on the base
- tialaramex 17d agoPresumably `string_view` is referring to C++ std::string_view ? It's not holding an "offset", it's a fat pointer, (ptr,len) or possibly (start,end) You're imagining this as (string_ptr,offset,len) but that's 50% bigger for no practical benefit, you cannot unwind a std::string_view to get the string it's a view into, indeed there may never have been such a string.