Small, indexable, unique, and statically-sized immutable arrays

I might be over-thinking this and I know I’m getting greedy here:

Is there an array type that is indexable, has only unique members, can not change in size or elements, and is relatively “small” (i.e. shorter than say 256)? The element type of this array will be String.

I will need to refer to the elements in these arrays and think that using a Int pointer might be cheaper than the actual String it’s pointed at (correct me if I’m wrong). These array should not contain duplicate elements, and once created should not change in size, nor should their elements change.

I can solve all of this with some checks and controls. For instance:

using StaticArrays
v(x::Vector{String}) = SVector(unique(x)...)

but it would be neat if this was baked into the type itself… Any ideas?

Wrap StaticVector in an immutable (with appropriate parameters), enforce uniqueness in the inner constructor.

1 Like

Actually, now that I think about it, maybe just a Tuple without the replicates. Cause I don’t need all the math behind StaticArrays.