Fix for std::pair< iterator, iterator > making the
iterator non-consts, when the key is always const and will prevent modification. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9816 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b20fd0d06f
commit
211ee4eb0a
1 changed files with 8 additions and 5 deletions
|
|
@ -453,13 +453,16 @@ namespace swig
|
||||||
RARRAY_LEN($result) = 2;
|
RARRAY_LEN($result) = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// std::map/multimap allow returning std::pair< iterator, iterator > from
|
||||||
|
// equal_range, but we cannot still modify the key, so the iterator is
|
||||||
|
// const.
|
||||||
%typemap(out,noblock=1,fragment="RubySequence_Cont")
|
%typemap(out,noblock=1,fragment="RubySequence_Cont")
|
||||||
std::pair<iterator, iterator> {
|
std::pair<iterator, iterator> {
|
||||||
$result = rb_ary_new2(2);
|
$result = rb_ary_new2(2);
|
||||||
RARRAY_PTR($result)[0] = SWIG_NewPointerObj(swig::make_nonconst_iterator(%static_cast($1,const $type &).first),
|
RARRAY_PTR($result)[0] = SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).first),
|
||||||
swig::Iterator::descriptor(),SWIG_POINTER_OWN);
|
swig::ConstIterator::descriptor(),SWIG_POINTER_OWN);
|
||||||
RARRAY_PTR($result)[1] = SWIG_NewPointerObj(swig::make_nonconst_iterator(%static_cast($1,const $type &).second),
|
RARRAY_PTR($result)[1] = SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).second),
|
||||||
swig::Iterator::descriptor(),SWIG_POINTER_OWN);
|
swig::ConstIterator::descriptor(),SWIG_POINTER_OWN);
|
||||||
RARRAY_LEN($result) = 2;
|
RARRAY_LEN($result) = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -478,7 +481,7 @@ namespace swig
|
||||||
%typemap(out,noblock=1,fragment="RubyPairBoolOutputIterator")
|
%typemap(out,noblock=1,fragment="RubyPairBoolOutputIterator")
|
||||||
std::pair<iterator, bool> {
|
std::pair<iterator, bool> {
|
||||||
$result = rb_ary_new2(2);
|
$result = rb_ary_new2(2);
|
||||||
RARRAY_PTR($result)[0] = SWIG_NewPointerObj(swig::make_nonconst_iterator(%static_cast($1,const $type &).first),
|
RARRAY_PTR($result)[0] = SWIG_NewPointerObj(swig::make_nonconst_iterator(%static_cast($1,$type &).first),
|
||||||
swig::Iterator::descriptor(),SWIG_POINTER_OWN);
|
swig::Iterator::descriptor(),SWIG_POINTER_OWN);
|
||||||
RARRAY_PTR($result)[1] = SWIG_From(bool)(%static_cast($1,const $type &).second);
|
RARRAY_PTR($result)[1] = SWIG_From(bool)(%static_cast($1,const $type &).second);
|
||||||
RARRAY_LEN($result) = 2;
|
RARRAY_LEN($result) = 2;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue