cppitertools icon indicating copy to clipboard operation
cppitertools copied to clipboard

Negative indexing on slice

Open gaffney2010 opened this issue 4 years ago • 1 comments

Have you thought about adding functionality for Python-style negative indices on the slice function?

gaffney2010 avatar May 28 '20 09:05 gaffney2010

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?

ryanhaining avatar Jun 01 '20 02:06 ryanhaining