class std.Array

import "std_Array.jnc"

class Array {
    // fields

    variant_t cmut* readonly m_p;
    size_t readonly m_count;
    size_t readonly m_maxCount;

    // methods

    void clear();
    void detach();
    bool errorcode setCount(size_t count);
    bool errorcode reserve(size_t count);

    size_t errorcode copy(
        variant_t const* p,
        size_t count
    );

    size_t errorcode copy(variant_t e);
    size_t errorcode append(variant_t e);

    size_t errorcode append(
        variant_t const* p,
        size_t count
    );

    size_t errorcode insert(
        size_t index,
        variant_t const* p,
        size_t count
    );

    size_t errorcode insert(
        size_t index,
        variant_t e
    );

    size_t remove(
        size_t index,
        size_t count = 1
    );

    void sort();
    void sort(std.LessFunc* lessFunc);
};