6 ms·
Problem is avoiding having to do Vec<Option<T>>
by __s 9y ago
Problem is avoiding having to do Vec<Option<T>>
- Animats 9y agoIf T is a reference type, doesn't Rust do an optimization where <Option<T>>> is implemented by using null pointers?
- kevincox 9y agoYes. This optimization is expected to be expanded in the future but there are currently "NonZero" types. Rust notices this and uses the zero value as the enum descriminant. So in this case the code generated is idential to a nullable pointer.
- sanxiyn 9y agoYes, but that doesn't help when T is not a reference type.