class std.RbTree

import "std_RbTree.jnc"

class RbTree {
    // fields

    std.MapEntry cmut* readonly m_head;
    std.MapEntry cmut* readonly m_tail;
    size_t readonly m_count;

    // properties

    bool const property m_isEmpty;

    // construction

    construct(std.CmpFunc thin* cmpFunc = null);
    destruct();

    // methods

    void clear();
    std.MapEntry* errorcode visit(variant_t key);
    std.MapEntry cmut* find(variant_t key) const;

    variant_t findValue(
        variant_t key,
        variant_t undefinedValue = null
    ) const;

    std.MapEntry* errorcode add(
        variant_t key,
        variant_t value
    );

    void remove(std.MapEntry* entry);
    bool removeKey(variant_t key);
};