What would be your opinion on including an associated list in std::collection?

Ah, from the [u8] fat pointer. My bad.

can the length be anything other than what is dictated by the Layout? I'd imagine for something like Box which doesn't store the size deallocating would be impossible (unless ofc deallocating wants the layout used in the allocation regardless what is the length of the slice (afaik the slice length must be the same as layout.size()))

Yes, an allocator may round it up to the next size class for example. For as long as the allocator can deterministically calculate the actual size from the original Layout, or stores it somewhere it can find it on deallocation again, having the allocator return more memory is completely fine.

1 Like

When deallocating the layout must fit the memory deallocated, it doesn't have to be exactly the same size.

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.