You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be good to give VirtualListVector a lifetime for the iterator.
Ex:
If we wanted to implement VirtualListVector for [T; N] where T: Clone, it might be desirable to have the iterator not clone the entire array at once in case it is large. So we'd have ItemIterator be std::iter::Copied<std::slice::Iter<'_, T>>.. but we can't specify any lifetime other than static which just won't work.
Ex:
If we wanted to implement VirtualListVector for Vec<T> where T: Clone then we could avoid a whole new heap allocation via letting the iterator hold a reference to it
Similarly, even im::Vector is having to clone the sliced part to an entire new vector when it is used.
I haven't taken a close look at whether this would cause any problems.
It might also be more desirable to return a &T instead? So a borrowed iterator.
The text was updated successfully, but these errors were encountered:
It would be good to give
VirtualListVector
a lifetime for the iterator.Ex:
If we wanted to implement
VirtualListVector
for[T; N]
whereT: Clone
, it might be desirable to have the iterator not clone the entire array at once in case it is large. So we'd haveItemIterator
bestd::iter::Copied<std::slice::Iter<'_, T>>
.. but we can't specify any lifetime other than static which just won't work.Ex:
If we wanted to implement
VirtualListVector
forVec<T>
whereT: Clone
then we could avoid a whole new heap allocation via letting the iterator hold a reference to itSimilarly, even
im::Vector
is having to clone the sliced part to an entire new vector when it is used.I haven't taken a close look at whether this would cause any problems.
It might also be more desirable to return a
&T
instead? So a borrowed iterator.The text was updated successfully, but these errors were encountered: