mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #6777 from dearblue/array-combination.4
This commit is contained in:
@@ -1600,10 +1600,11 @@ ary_combination_next(mrb_state *mrb, mrb_value self)
|
||||
}
|
||||
}
|
||||
|
||||
/* Build current combination indices */
|
||||
/* Build current combination */
|
||||
mrb_value result = mrb_ary_new_capa(mrb, state->n);
|
||||
const mrb_value *p = RARRAY_PTR(self);
|
||||
for (mrb_int i = 0; i < state->n; i++) {
|
||||
mrb_ary_push(mrb, result, mrb_fixnum_value(state->indices[i]));
|
||||
mrb_ary_push(mrb, result, p[state->indices[i]]);
|
||||
}
|
||||
|
||||
mrb_int pos = state->n - 1;
|
||||
|
||||
Reference in New Issue
Block a user