Type Aliases

The following type aliases are available globally.

  • Type of the comparator that can be supplied to the BSTree constructors to provide an order if the tree values are not Comparable, or to override the innate ordering.

    For example, if we wanted the ordering for String values to be case insensitive:

    let tree = BSTree() { (s1: String, s2: String) in
        return s1.lowercased() < s2.lowercased()
    }
    

    or more succinctly:

    let tree = BSTree() { $0.lowercased() < $1.lowercased() }
    

    Declaration

    Swift

    public typealias Ordered<T> = (T, T) -> Bool