digitalmars.D.learn - Trait hasIndexing
- =?UTF-8?B?Tm9yZGzDtnc=?= (5/5) Oct 11 2016 I can't find any traits `hasIndexing!R` corresponding to
- =?UTF-8?B?Tm9yZGzDtnc=?= (3/5) Oct 11 2016 My definition of `hasIndexing` so far:
- Jonathan M Davis via Digitalmars-d-learn (6/11) Oct 11 2016 The traits in std.range are specifically for ranges, and isRandomAccessR...
I can't find any traits `hasIndexing!R` corresponding to `std.range.primitives.hasSlicing!R` that is `true` iff `R` has `opIndex[size_t]` defined. Is there one? If not what should I use instead?
Oct 11 2016
On Tuesday, 11 October 2016 at 10:08:02 UTC, Nordlöw wrote:I can't find any traits `hasIndexing!R` corresponding to `std.range.primitives.hasSlicing!R`My definition of `hasIndexing` so far: https://github.com/nordlow/phobos-next/blob/master/src/typecons_ex.d#L83
Oct 11 2016
On Tuesday, October 11, 2016 10:08:02 Nordlöw via Digitalmars-d-learn wrote:I can't find any traits `hasIndexing!R` corresponding to `std.range.primitives.hasSlicing!R` that is `true` iff `R` has `opIndex[size_t]` defined. Is there one? If not what should I use instead?The traits in std.range are specifically for ranges, and isRandomAccessRange already covers indexing, which is why there isn't a separate trait for indexing in there. There certainly _could_ be one in std.traits, but there isn't at present. - Jonathan M Davis
Oct 11 2016