std::vector<chtype> chstr(NUM2INT(rb_funcall(array, rb_intern("size"), 0)) + 1); for (unsigned long i = 0; i < chstr.size(); ++i) {
size_t string_length = NUM2ULONG(rb_funcall(array, rb_intern("size"), 0)); size_t vector_length = string_length + 1; std::vector<chtype> chstr(vector_length); for (unsigned long i = 0; i < string_length; ++i) {
static std::vector<chtype> RB2CHSTR(VALUE array){    if (rb_obj_is_instance_of(array, rb_cArray) != Qtrue) {        rb_raise(rb_eArgError,                 "chtype string argument must be an empty Array");        return std::vector<chtype>();    }    std::vector<chtype> chstr(NUM2INT(rb_funcall(array, rb_intern("size"),                                                 0)) + 1);    for (unsigned long i = 0; i < chstr.size(); ++i) {        chstr[i] = NUM2ULONG(rb_ary_entry(array, i));    }    return chstr;}