Fragments can now be "type especialized", as the typemaps. The
syntax is as follows
%fragment("name","header") { /* an old fragment */ }
%fragment("name" {Type}, "header") { /* the fragment is type dependent */}
Now fragments can also be used inside templates:
template <class T>
struct A {
%fragment("incode"{A<T>},"header") {
/* 'incode' especialized fragment */
}
%typemap(in,fragment="incode"{A<T>}) {
/*
here we use the 'type especialized' fragment
"incode"{A<T> }
*/
}
};
Also, there is a minor templ.c fix when expanding '#T'.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5749 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
d05b12f642
commit
6184dceb5b
2 changed files with 55 additions and 14 deletions
|
|
@ -177,6 +177,7 @@ cparse_template_expand(Node *n, String *tname, String *rname, String *templatear
|
|||
Append(typelist, Getattr(n,"type"));
|
||||
Append(typelist, Getattr(n,"decl"));
|
||||
add_parms(Getattr(n,"parms"), cpatchlist, typelist);
|
||||
add_parms(Getattr(n,"kwargs"), cpatchlist, typelist);
|
||||
add_parms(Getattr(n,"pattern"), cpatchlist, typelist);
|
||||
add_parms(Getattr(n,"throws"), cpatchlist, typelist);
|
||||
cn = firstChild(n);
|
||||
|
|
@ -329,7 +330,7 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms) {
|
|||
tydef = value;
|
||||
}
|
||||
tmp = NewStringf("#%s",name);
|
||||
tmpr = NewStringf("\"%s\"", value);
|
||||
tmpr = NewStringf("\"%s\"", valuestr);
|
||||
|
||||
sz = Len(cpatchlist);
|
||||
for (i = 0; i < sz; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue