Requirements for Slicing Ranges
Jonathan M Davis
newsgroup.d at jmdavisprog.com
Mon Sep 2 05:22:00 UTC 2024
On Sunday, September 1, 2024 10:54:02 PM MDT Richard (Rikki) Andrew Cattermole
via Digitalmars-d wrote:
> Your question appears to be answered :)
Probably. I'm just trying to make sure that there isn't some corner case
that I'm missing.
As far as I can tell, if you can index a range in O(1), it should be
possible to implement slicing in O(1), and if you can slice a range in O(1),
it should be possible to index it in O(1) (at least as long as the
requirement to have slicing give you the same type remains in place), but
the current range API does not make that assumption, which is kind of weird.
So, I'm asking if anyone is able to see a hole in that logic or a corner
case where it somehow really would make sense to be able to slice a range
but not be able to also index that range. I don't _think_ that such a thing
is possible, but it's possible that I'm missing something here, and someone
else may see something that I don't. I'm 99% certain that I have a proper
grasp of the situation, but I'd just like to be doubly sure.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list