odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
6.12k stars 550 forks source link

Loosen constraint on the Key type in rb & avl tree #3780

Closed destroycomputers closed 2 weeks ago

destroycomputers commented 2 weeks ago

The current constraint on the init_ordered function accepts only numeric types. While one still can init a non-numerically-keyed tree by passing a comparator explicitly, the reason to disallow non-numeric ordered types is nowhere to be found.

laytan commented 2 weeks ago

Note that the where clause will now allow pointer types through, which are not comparable with less/greater than. It is probably fine though, it will still error somewhere else.