Have anybody created a wrapper container
struct Sorted(ArrayLike, alias lessThanPred)
that wraps an array-like type ArrayLike
so that it's always sorted according to the binary predicate lessThanPred
?
Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
November 12, 2022 Sorted Array (Container) Type | ||||
---|---|---|---|---|
| ||||
Have anybody created a wrapper container
that wraps an array-like type |
November 13, 2022 Re: Sorted Array (Container) Type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Saturday, 12 November 2022 at 14:07:46 UTC, Per Nordlöw wrote: >Have anybody created a wrapper container
that wraps an array-like type I'm not sure if these are a good fit for what you need, but have you checked https://dlang.org/phobos/std_container_rbtree.html and https://dlang.org/phobos/std_container_binaryheap.html ? |
November 14, 2022 Re: Sorted Array (Container) Type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Siarhei Siamashka | On Sunday, 13 November 2022 at 18:51:09 UTC, Siarhei Siamashka wrote: >On Saturday, 12 November 2022 at 14:07:46 UTC, Per Nordlöw wrote: >Have anybody created a wrapper container
that wraps an array-like type I'm not sure if these are a good fit for what you need, but have you checked https://dlang.org/phobos/std_container_rbtree.html and https://dlang.org/phobos/std_container_binaryheap.html ? He said on Discord he want contiguous data structure, rbtree allocates too much |
November 14, 2022 Re: Sorted Array (Container) Type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tejas | On Monday, 14 November 2022 at 00:29:40 UTC, Tejas wrote: >He said on Discord he want contiguous data structure, rbtree allocates too much OK, I guess this person got their question answered on Discord and does not need any further assistance. |
November 15, 2022 Re: Sorted Array (Container) Type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tejas | On Monday, 14 November 2022 at 00:29:40 UTC, Tejas wrote: >He said on Discord he want contiguous data structure, rbtree allocates too much rbtree has it's uses cases. I wanted a sorted array because I want to include it in a benchmark suite and study it's time and space complexity. No application yet. |
November 15, 2022 Re: Sorted Array (Container) Type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | This is what I have so far.
. But I don't understand why my call to completeSort isn't allowed by the compiler and errors as
What am I missing? |
November 15, 2022 Re: Sorted Array (Container) Type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | 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
|
November 15, 2022 Re: Sorted Array (Container) Type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | 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
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
|
November 15, 2022 Re: Sorted Array (Container) Type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Tuesday, 15 November 2022 at 22:32:56 UTC, Per Nordlöw wrote: >Still, does anybody understand why the line https://github.com/nordlow/phobos-next/blob/master/src/nxt/sorted.d#L52 fails to compile Maybe add two typeof arguments?
|
November 15, 2022 Re: Sorted Array (Container) Type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Tuesday, 15 November 2022 at 20:09:40 UTC, Per Nordlöw wrote: >I wanted a sorted array because I want to include it in a benchmark suite and study it's time and space complexity. No application yet. For doing a fast insert into an already sorted array (and avoiding duplicated values) it's probably better to do something like this:
|