3.27. kink/container/FLAT_SET

Provides an ordered_set implementation which stores all the elements in a sorted vec.

This set implementation is intended to be used when the size of the set is limited to a small number, or new elements are rarely inserted after initially constructed.

Worst-case computational orders of each operations are as follows:

have?: Θ(log N)

push: Θ(N)

remove: Θ(N)

size, empty?, nonempty?: Θ(1)

Where N is the size of the set.

3.27.1. FLAT_SET.of(...Elems)

Makes a flat set with the natural ordering, containing Elems.

In the natural ordering, X precedes Y if X < Y.

3.27.2. FLAT_SET.of_each(Eacher)

Makes a flat set with the natural ordering, containing each element of the Eacher.

In the natural ordering, X precedes Y if X < Y.

3.27.3. FLAT_SET.new([[$config = {}]])

Makes an empty ordered_set with the flat set implementation.

$config must take a Conf as a param. The Conf val has the following method.

Conf.precede_fun($_precede?): sets $_precede? to be used to determine the strict weak ordering of elems. $_precede? must take two parameters, and returns true if the first parameter precedes the second one in the ordering, or false otherwise.

If Conf.precede_fun is not called, the natural ordering is used.