Sorted Array (Container) Type

Per Nordlöw per.nordlow at gmail.com
Tue Nov 15 22:32:56 UTC 2022


On Tuesday, 15 November 2022 at 22:15:36 UTC, Per Nordlöw wrote:
> On Tuesday, 15 November 2022 at 21:03:24 UTC, Per Nordlöw wrote:
>> This is what I have so far.
>
> Found some issues but still cannot instantiate my solution at
>
> https://github.com/nordlow/phobos-next/blob/master/src/nxt/sorted.d#L15
>
> when I uncomment the line containing
>
> ```d
> // TODO: completeSort!(less, ss)(_source[0 .. 
> n].assumeSorted!(less), _source[n .. $]);
> ```

I made an adjustment to make better use of existing member 
functions of SortedRange.

Still, does anybody understand why the line 
https://github.com/nordlow/phobos-next/blob/master/src/nxt/sorted.d#L52 fails to compile as

```sorted.d(52): Error: none of the overloads of template 
`std.algorithm.sorting.completeSort` are callable using argument 
types `!("a < b", SwapStrategy.unstable)(SortedRange!(int[], "a < 
b", SortedRangeOptions.assumeSorted), int[])`
/home/per/.local/dlang/linux/bin64/src/phobos/std/algorithm/sorting.d(117):        Candidate is: `completeSort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable, Lhs, Rhs)(SortedRange!(Lhs, less) lhs, Rhs rhs)`
sorted.d(74): Error: template instance `nxt.sorted.Sorted!(int[], 
"a < b", SwapStrategy.unstable).Sorted.insert!int` error 
instantiating```


More information about the Digitalmars-d-learn mailing list