Skip to content

Commit

Permalink
Fix template instance friend functions
Browse files Browse the repository at this point in the history
  • Loading branch information
HGuillemet committed Jan 2, 2024
1 parent 82f2dd2 commit 6fa69be
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/main/java/org/bytedeco/javacpp/tools/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -1381,18 +1381,14 @@ Declarator declarator(Context context, String defaultName, int infoNumber, boole
}
} else if (token.match('<')) {
// template arguments
dcl.cppName += token;
int count2 = 0;
for (token = tokens.next(); !token.match(Token.EOF); token = tokens.next()) {
dcl.cppName += token;
if (count2 == 0 && token.match('>')) {
break;
} else if (token.match('<')) {
count2++;
} else if (token.match('>')) {
count2--;
}
}
Type[] types = templateArguments(context);
dcl.cppName += "<";
for (int i = 0; i<types.length; i++) {
if (i > 0) dcl.cppName += ",";
dcl.cppName += types[i].cppName;
}
if (dcl.cppName.endsWith(">")) dcl.cppName += " ";
dcl.cppName += ">";
} else if (token.match(Token.IDENTIFIER) &&
(dcl.cppName.length() == 0 || dcl.cppName.endsWith("::"))) {
dcl.cppName += token;
Expand Down Expand Up @@ -1640,7 +1636,7 @@ Declarator declarator(Context context, String defaultName, int infoNumber, boole
// pick the Java name from the InfoMap if appropriate
String originalName = fieldPointer ? groupInfo.pointerTypes[0] : dcl.javaName;
if (attr == null && defaultName == null && info != null && info.javaNames != null && info.javaNames.length > 0
&& (dcl.operator || Templates.notExists(info.cppNames[0]) || (context.templateMap != null && context.templateMap.type == null))) {
&& info.cppNames[0].equals(dcl.cppName)) {
dcl.javaName = info.javaNames[0];
}

Expand Down

0 comments on commit 6fa69be

Please sign in to comment.