Are semitokens in a SortedSet persistent?


#1

I am trying to write a code for a scheduler of moves for Monte-Carlo simulation. Basically, I need a container where I could insert an event scheduled to happen at a given time, and keep the set of times sorted. Once in a while, the first element of the set is popped; the corresponding event can invalidate some already programmed events and also can make possible some other ones. Thus, one has to access the sorted set of times by some sort of a unique identifier, and the best thing I can think of is SortedSet.SemiToken. This is why I use a Dictionary mapping an external id::Int64 to the internal type SemiToken. Here’s how the type is defined:

mutable struct Scheduler
    times::SortedSet{Float64}
    moves::Dict{Int64,IntSemiToken}
    wc::Float64
end

The question is: can one rely on that the semi-token of an element in a SortedSet will remain valid as long as the element itself is not removed from the collection, irrespective of what happens with other elements?

Thanks.

Update: it seems that semitokens are de facto not invalidated (in the implementation of BalancedTree23, the elements of the array data are not moved). However, the question remains, since this seems to be an undocumented feature.