3 ms·
Implementing STL iterators are a bloody PITA
by my-next-account 4mo ago
Implementing STL iterators are a bloody PITA
- flohofwoe 4mo agoYou don't need iterators for the range-based for loop, just a .begin() and .end() method which returns a raw pointer is enough. E.g.: https://github.com/floooh/oryol/blob/eb08cffe1b1cb6b05ed14ec692bca9372cef064e/code/Modules/Core/Containers/Array.h#L127-L134 https://github.com/floooh/oryol/blob/eb08cffe1b1cb6b05ed14ec... (don't use that project though because it's been archived, I've switched back to plain old C in the meantime)
- my-next-account 4mo agoIf it's a contiguous array, then sure.
- t0mpr1c3 4mo agostd::range fixes this