Re: Using sets in associative arrays

2024-11-12 Thread Ralph via Digitalmars-d-learn
On Tuesday, 12 November 2024 at 07:47:58 UTC, Sergey wrote: On Tuesday, 12 November 2024 at 00:42:41 UTC, Ralph wrote: Hi there, I know it is possible to declare an associative array which takes arrays as values, i.e. **int[][int] arr;** A sample of this could be **arr[2] = [2, 3, 2, 4, 5];**

Re: Using sets in associative arrays

2024-11-11 Thread Sergey via Digitalmars-d-learn
On Tuesday, 12 November 2024 at 00:42:41 UTC, Ralph wrote: Hi there, I know it is possible to declare an associative array which takes arrays as values, i.e. **int[][int] arr;** A sample of this could be **arr[2] = [2, 3, 2, 4, 5];** I was wondering if there was a way to have this with sets

Re: Using sets in associative arrays

2024-11-11 Thread Olivier Pisano via Digitalmars-d-learn
Hello, In your case, the type "set of integers" would be written as `RedBlackTree!int` in D. Note that it starts with an uppercase R, and takes the type of values to contain as template argument (the int after the exclamation mark). Btw, in the standard library, types always start with an u