I don’t understand what the use case for SortedSet is. It seems to only collect and sort keys, with no values associated with those keys.
I have a homogeneous collection of structs (points of a parameterized curve in a three dimensional space), each one of which has a field (the parameter) whose value could serve as a sort key which would allow me to visit the structs in parameter order – a core behavior of my application.
Though I can define an orderiing based on this key value:
struct StrandPointOrdering <: Base.Order.Ordering end Base.Order.lt(o::StrandPointOrdering, a, b) = a.p < b.p
I have no way to find an element by that key value, other than by iterating through the entire set.
If I were to use SortedDict instead, the key value would be redundantly stored, and in each reference to the dict, I would need to add extra code to extract my struct from each dict entry
I looked at NearestNeighbors.jl but it does not allow modification of the data set. There is some appeal to being able to query my data by a region of the [parameter, x, y, z] space, I don’t expect the typical use of my application to have more than hundreds of such structs.
Am I misunderstanding SortedSet and SortedDict? Is there some other sorted mutable collection type I should look at?