Fixed a bug with argout values being incorrectly
returned when the first argout/returned element was an array. Made std::pair and container returned elements be frozen (like tuples in python). Added the std_containers.i test from python and created a ruby runme file for it. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9746 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3ccbac69aa
commit
1b349d4749
6 changed files with 360 additions and 4 deletions
|
|
@ -1007,6 +1007,7 @@ namespace swig {
|
|||
RARRAY_PTR(obj)[i] = swig::from<value_type>(*it);
|
||||
}
|
||||
RARRAY_LEN(obj) = size;
|
||||
rb_obj_freeze(obj); // treat as immutable result
|
||||
return obj;
|
||||
} else {
|
||||
rb_raise(rb_eRangeError,"sequence size not valid in ruby");
|
||||
|
|
|
|||
|
|
@ -124,13 +124,15 @@
|
|||
|
||||
static VALUE from(const std::pair<T,U>& val) {
|
||||
VALUE obj = rb_ary_new2(2);
|
||||
RARRAY_PTR(obj)[0] = swig::from< typename swig::noconst_traits<T >::noconst_type>(val.first);
|
||||
RARRAY_PTR(obj)[0] = swig::from<
|
||||
typename swig::noconst_traits<T >::noconst_type>(val.first);
|
||||
RARRAY_PTR(obj)[1] = swig::from(val.second);
|
||||
RARRAY_LEN(obj) = 2;
|
||||
rb_define_singleton_method(obj, "second",
|
||||
VALUEFUNC(_wrap_pair_second), 0 );
|
||||
rb_define_singleton_method(obj, "second=",
|
||||
VALUEFUNC(_wrap_pair_second_eq), 1 );
|
||||
rb_obj_freeze(obj); // treat as immutable tuple
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue