InputRange for data structure without order?
H. S. Teoh
hsteoh at qfbox.info
Wed Jun 4 19:09:30 UTC 2025
On Wed, Jun 04, 2025 at 12:00:57PM -0700, Ali Çehreli via Digitalmars-d-learn wrote:
> On 6/4/25 4:10 AM, Monkyyy wrote:
> > On Wednesday, 4 June 2025 at 02:11:18 UTC, H. S. Teoh wrote:
> >> . But in general, containers should NOT be conflated with ranges.
> >> That only leads to wrong design.
> >>
> >> range should NOT mutate the container. It should be regarded as
> >> something separate from the container.
> >
> > Not "general". It's a safety vs speed tradeoff. Immutable whatever's
> > data structure do just make allot of copies or allot of pointer
> > overhead and indirection.
What has this got to do with immutable? I never said the container
should be immutable, only that range over its contents should not mutate
it.
T
--
Being forced to write comments actually improves code, because it is easier to fix a crock than to explain it. -- G. Steele
More information about the Digitalmars-d-learn
mailing list