Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
October 16, 2018 [Issue 9792] length field of a const SortedRange | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=9792 Nathan S. <n8sh.secondary@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |n8sh.secondary@hotmail.com See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=7521 -- |
February 26, 2020 [Issue 9792] length field of a const SortedRange | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=9792 Ali Cehreli <acehreli@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |acehreli@yahoo.com --- Comment #3 from Ali Cehreli <acehreli@yahoo.com> --- I ran into this in a post condition code: import std.algorithm; auto foo() out (result; result.length == 1) { // <-- ERROR return [ 0 ].sort; } void main() { } Error: mutable method `std.range.SortedRange!(int[], "a < b").SortedRange.length` is not callable using a `const` object Consider adding `const` or `inout` to std.range.SortedRange!(int[], "a < b").SortedRange.length Ali -- |
April 30, 2020 [Issue 9792] length field of a const SortedRange | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=9792 Witold Baryluk <witold.baryluk+d@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |witold.baryluk+d@gmail.com --- Comment #4 from Witold Baryluk <witold.baryluk+d@gmail.com> --- I got similar issues with constness, in other cirumstances. `opIndex` and `opSlice` could be made const too, if they return const range or SortedRange, and underlying Range is const. I have a method like this: void search(Range, T)(in T[] needles, in SortedRange!(Range) haystack, long[] ret, const long index_offset) { it is called as search(needles, assumeSorted(kaystack), ret, 0); but the body of this function does pose issues: search.d:67:7: error: mutable method std.range.SortedRange!(const(int)[], "a < b").SortedRange.length is not callable using a const object 67 | if (haystack.length == 0) { | ^ search.d:83:17: error: mutable method std.range.SortedRange!(const(int)[], "a < b").SortedRange.opIndex is not callable using a const object 83 | if (haystack[i] == needles[j]) { This is with gdc 9.3.0-11 and libgphobos76 9.3.0-11. It looks like automatic inference of const methods, or specialization of const and non-const (at the cost of repeating the same code twice) is required to make it work. -- |
April 30, 2020 [Issue 9792] length field of a const SortedRange | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=9792 --- Comment #5 from Witold Baryluk <witold.baryluk+d@gmail.com> --- Same issue with `SortedRange.trisect` too. -- |
December 17, 2022 [Issue 9792] length field of a const SortedRange | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=9792 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P2 |P3 -- |
Copyright © 1999-2021 by the D Language Foundation