A size type parameter for collections

There was some talk of having collections parametrized by their length/size type in the polymorphic indexing/implicit widening thread. The idea is to give the standard collections another type parameter that defaults to usize, so Vec<T> would be Vec<T,S = usize>. Consider custom allocators, where fixed-sized allocators such as arenas and mmap exist. When using a collection with such an allocator, the size can’t grow above the known fixed size of the allocator, so it doesn’t make sense to use a unnecessarily big type for the size of the container.

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