On Thu, Apr 06, 2023 at 01:20:28AM +0000, Paul via Digitalmars-d-learn wrote:
[...]
> Yes I understand, basically, what's going on in hardware.  I just
> wasn't sure if the access type was linked to the container type.  It
> seems obvious now, since you've both made it clear, that it also
> depends on how I'm accessing my container.
> 
> Having said all of this, isn't a D 'range' fundamentally a sequential
> access container (i.e popFront) ?

D ranges are conceptually sequential, but the actual underlying memory
access patterns depends on the concrete type at runtime. An array's
elements are stored sequentially in memory, and arrays are ranges.  But
a linked-list can also have a range interface, yet its elements may be
stored in non-consecutive memory locations.  So the concrete type
matters here; the range API only gives you conceptual sequentiality, it
does not guarantee physically sequential memory access.


T

-- 
Many open minds should be closed for repairs. -- K5 user

Reply via email to