diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg index b8489ed4b..287bb14b6 100644 --- a/Lib/python/pycontainer.swg +++ b/Lib/python/pycontainer.swg @@ -654,7 +654,15 @@ namespace swig } } -%define %swig_sequence_iterator(Make_output_iterator_func,Sequence...) +%define %swig_sequence_iterator(Sequence...) + %swig_sequence_iterator_with_making_function(swig::make_output_iterator,Sequence...) +%enddef + +%define %swig_sequence_forward_iterator(Sequence...) + %swig_sequence_iterator_with_making_function(swig::make_output_forward_iterator,Sequence...) +%enddef + +%define %swig_sequence_iterator_with_making_function(Make_output_iterator,Sequence...) #if defined(SWIG_EXPORT_ITERATOR_METHODS) class iterator; class reverse_iterator; @@ -663,15 +671,15 @@ namespace swig %typemap(out,noblock=1,fragment="SwigPySequence_Cont") iterator, reverse_iterator, const_iterator, const_reverse_iterator { - $result = SWIG_NewPointerObj(Make_output_iterator_func(%static_cast($1,const $type &)), + $result = SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &)), swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); } %typemap(out,noblock=1,fragment="SwigPySequence_Cont") std::pair, std::pair { $result = PyTuple_New(2); - PyTuple_SetItem($result,0,SWIG_NewPointerObj(Make_output_iterator_func(%static_cast($1,const $type &).first), + PyTuple_SetItem($result,0,SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &).first), swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN)); - PyTuple_SetItem($result,1,SWIG_NewPointerObj(Make_output_iterator_func(%static_cast($1,const $type &).second), + PyTuple_SetItem($result,1,SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &).second), swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN)); } @@ -680,7 +688,7 @@ namespace swig %typemap(out,noblock=1,fragment="SwigPyPairBoolOutputIterator") std::pair, std::pair { $result = PyTuple_New(2); - PyTuple_SetItem($result,0,SWIG_NewPointerObj(Make_output_iterator_func(%static_cast($1,const $type &).first), + PyTuple_SetItem($result,0,SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &).first), swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN)); PyTuple_SetItem($result,1,SWIG_From(bool)(%static_cast($1,const $type &).second)); } @@ -715,7 +723,7 @@ namespace swig %newobject iterator(PyObject **PYTHON_SELF); %extend { swig::SwigPyIterator* iterator(PyObject **PYTHON_SELF) { - return Make_output_iterator_func(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + return Make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); } #if defined(SWIGPYTHON_BUILTIN) @@ -764,7 +772,7 @@ namespace swig %define %swig_sequence_methods_common(Sequence...) -%swig_sequence_iterator(swig::make_output_iterator,%arg(Sequence)) + %swig_sequence_iterator(%arg(Sequence)) %swig_container_methods(%arg(Sequence)) %fragment("SwigPySequence_Base"); diff --git a/Lib/python/std_map.i b/Lib/python/std_map.i index 0e37d065e..f61f79c44 100644 --- a/Lib/python/std_map.i +++ b/Lib/python/std_map.i @@ -149,7 +149,7 @@ } %define %swig_map_common(Map...) - %swig_sequence_iterator(swig::make_output_iterator,Map); + %swig_sequence_iterator(Map); %swig_container_methods(Map) #if defined(SWIGPYTHON_BUILTIN) diff --git a/Lib/python/std_set.i b/Lib/python/std_set.i index 9820cbb3c..53f97e475 100644 --- a/Lib/python/std_set.i +++ b/Lib/python/std_set.i @@ -33,7 +33,7 @@ %} %define %swig_set_methods(set...) - %swig_sequence_iterator(swig::make_output_iterator,set); + %swig_sequence_iterator(set); %swig_container_methods(set); %extend { diff --git a/Lib/python/std_unordered_map.i b/Lib/python/std_unordered_map.i index 2af261185..8ab4b1447 100644 --- a/Lib/python/std_unordered_map.i +++ b/Lib/python/std_unordered_map.i @@ -122,7 +122,7 @@ } %define %swig_unordered_map_common(Map...) - %swig_sequence_iterator(swig::make_output_forward_iterator,Map); + %swig_sequence_forward_iterator(Map); %swig_container_methods(Map) %extend { diff --git a/Lib/python/std_unordered_set.i b/Lib/python/std_unordered_set.i index 4db24f74b..6c646509c 100644 --- a/Lib/python/std_unordered_set.i +++ b/Lib/python/std_unordered_set.i @@ -40,7 +40,7 @@ %} %define %swig_unordered_set_methods(unordered_set...) - %swig_sequence_iterator(swig::make_output_forward_iterator,unordered_set); + %swig_sequence_forward_iterator(unordered_set); %swig_container_methods(unordered_set); %extend {