cppitertools
cppitertools copied to clipboard
Negative indexing on slice
Have you thought about adding functionality for Python-style negative indices on the slice function?
Yeah, I would also like to be able to use that, but it's pretty complicated to implement. Everything in iter::slice
needs to work with types that don't support std::prev
/ operator--
, so there would be some wacky complie-time conditional work. The best I could say for now would be to use iter::slice
+ iter::reversed
, unless you can point to a case where that doesn't get what you want?