Change typemap matching rules for the default type (SWIGTYPE) to follow template partial specialization type deduction. Fixes some containers of const pointers. SWIGTYPE*& typemps removed and replaced with SWIGTYPE *const&.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11958 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-04-01 18:26:37 +00:00
commit bdb136d611
41 changed files with 477 additions and 122 deletions

View file

@ -115,12 +115,12 @@
}
}
%typemap(in) SWIGTYPE *& ($*ltype temp)
%typemap(in) SWIGTYPE *const& ($*ltype temp)
{
if(SWIG_ConvertPtr(*$input, (void **) &temp, $*1_descriptor, 0) < 0) {
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor");
}
$1 = &temp;
$1 = ($1_ltype)&temp;
}
%typemap(in) SWIGTYPE *DISOWN
@ -339,7 +339,7 @@
SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner);
%}
%typemap(out) SWIGTYPE *&
%typemap(out) SWIGTYPE *const&
%{
SWIG_SetPointerZval(return_value, (void *)*$1, $*1_descriptor, $owner);
%}
@ -394,10 +394,6 @@
SWIG_SetPointerZval($input, SWIG_as_voidptr(&$1_name), $&1_descriptor, 2);
}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
%typemap(out) void "";
%typemap(out) char [ANY]
@ -441,10 +437,11 @@
_v = (SWIG_ConvertPtr(*$input, (void **)&tmp, $&1_descriptor, 0) >= 0);
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *,
%typecheck(SWIG_TYPECHECK_POINTER)
SWIGTYPE *,
SWIGTYPE [],
SWIGTYPE &,
SWIGTYPE *&
SWIGTYPE *const&
{
void *tmp;
_v = (SWIG_ConvertPtr(*$input, (void**)&tmp, $1_descriptor, 0) >= 0);
@ -478,6 +475,12 @@
SWIG_PHP_Error(E_ERROR, (char *)$1);
%}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* php keywords */
%include <phpkw.swg>

View file

@ -29,7 +29,7 @@ namespace std {
unsigned int size() const;
void clear();
%extend {
T& get(const K& key) throw (std::out_of_range) {
const T& get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;