microsoft / xlang

MIT License
877 stars 103 forks source link

Make C++/WinRT's fast iterators provide general-purpose random access semantics #506

Closed kennykerr closed 5 years ago

kennykerr commented 5 years ago

The fast iterators were originally designed to simplify and optimize use of IVector and IVectorView in range-based for loops and thus only support forward iteration. These containers are however capable of supporting random access. The fast iterator should be updated to provide complete random access iterator semantics and the reverse fast iterator can then probably just rely on std::make_reverse_iterator.

kennykerr commented 5 years ago

Going to leave this for now. The fast iterators are great for optimizing and simplifying range-based for loops for WinRT collections, but if you're going to do any serious algorithm-based computation you're probably better off getting your data into a standard container to avoid the ABI overhead. If we come across a compelling scenario we can always revisit.