Was wondering if there is a way to get the data inside an rbtree as a simple array or a std.array, besides manually copying? Apologies if the answer is obvious and I missed it.
Thread overview | |||||
---|---|---|---|---|---|
|
3 days ago rbtree to array? | ||||
---|---|---|---|---|
| ||||
3 days ago Re: rbtree to array? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pete Padil | On Tuesday, 6 May 2025 at 04:57:46 UTC, Pete Padil wrote: >Was wondering if there is a way to get the data inside an rbtree as a simple array or a std.array, besides manually copying? Apologies if the answer is obvious and I missed it. Rbtree has a range interface of d. Its memory layout is similar to a linked list, where the data is not contiguous. So, you have to copy the elements manually. But it is always a nice practice to use library functions, doing it for you.
|
2 days ago Re: rbtree to array? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ferhat Kurtulmuş | On Tuesday, 6 May 2025 at 06:50:36 UTC, Ferhat Kurtulmuş wrote: >Rbtree has a range interface of d. Its memory layout is similar to a linked list, where the data is not contiguous. So, you have to copy the elements manually. But it is always a nice practice to use library functions, doing it for you.
Excellent - thank you! |