Description
openedon Jan 22, 2020
There is a common pattern for handling not knowing the type of something produced in an iterative fashion, and gathering it up into the smallest container.
Basically you start with the container able something (This bit I think sometimes varies, it could be the first elements eltype, could be result of @default_eltype
),
then you get the next thing you want to put in, if it fits then you push it in and continue,
if not then you make a new collection that can hold the union, copy everything over and then repeat.
The core of it is in push_widen!
but bits of the setup are in the Set
construct, in unique!
and in other places
Lines 681 to 716 in 2d57411
We should look into a standard and public way to do this.
Its wanted in JuliaCollections/DataStructures.jl#568 (comment)