From e97181ebc07a4755c1ab3e6f08eef12a3f9de07e Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 17 Sep 2022 10:23:51 +0100 Subject: Add missing typecheck typemaps for std::auto_ptr and std::unique_ptr To fix overloading when using these types. --- Lib/ruby/std_auto_ptr.i | 6 ++++++ Lib/ruby/std_unique_ptr.i | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'Lib/ruby') diff --git a/Lib/ruby/std_auto_ptr.i b/Lib/ruby/std_auto_ptr.i index d062886e4..3d7ae8ba1 100644 --- a/Lib/ruby/std_auto_ptr.i +++ b/Lib/ruby/std_auto_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/ruby/std_unique_ptr.i b/Lib/ruby/std_unique_ptr.i index 1a7ec06fa..f988714df 100644 --- a/Lib/ruby/std_unique_ptr.i +++ b/Lib/ruby/std_unique_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::unique_ptr< TYPE >; %enddef -- cgit v1.2.1