How to foreach over a DList?
monarch_dodra
monarchdodra at gmail.com
Mon Mar 31 23:04:48 PDT 2014
On Tuesday, 1 April 2014 at 04:43:44 UTC, H. S. Teoh wrote:
> On Mon, Mar 31, 2014 at 09:55:01PM +0000, monarch_dodra wrote:
>> On Monday, 31 March 2014 at 21:41:16 UTC, H. S. Teoh wrote:
>> >Argh, why is opSlice non-const? :-( Please file a bug.
>>
>> If opSlice was const, then you'd get a const slice, with const
>> reference. You wouldn't even be able to iterate on it.
> [...]
>
> Um... wat?
I'm pointing out the fix is not as trivial as slapping "const"
onto the signature. It requires a very real investment in terms
of development.
> I didn't say opSlice should return a const object (that would be
> ridiculous, as you point out). Rather, it should return a
> tail-const
> range that iterates over the const items in the const list.
Yes.
> A const container that cannot be iterated over makes no sense
> at all.
> Iterating over something doesn't modify anything!!
Yes.
More information about the Digitalmars-d-learn
mailing list