-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support anonymous template parameters #742
Conversation
Why square brackets? If we want something that looks like it's for templates, why not |
We must use something that cannot be an identifier, and that encodes the position of the parameter in the list. |
It could be useful to also amend |
Yeah, no, let's not try to encode anything. Let's just do as with functions, that is arg0, arg1, arg2, ... If that causes a conflict at some point, let's get back to it at that point. |
Why do you want to risk a conflict when we can avoid it ? |
Meh, ok, whatever, |
In what situation could we use this placeholder as an identifier ? |
Can we finalize this ? |
We could potentially attach some Info to them at some point, and in that case we're already using the slash for "basic/containers" and "basic/types", so what about "template/arg0", ... Good enough? |
Why not. Or public String toString() {
String s = "<";
for (Map.Entry<String, Type> e : entrySet()) {
if (s.length() > 1) {
s += ",";
}
Type t = e.getValue();
if (t == null) {
String k = e.getKey();
s += k.startsWith("@") ? "typename" : k; // HERE
} else {
s += t.cppName;
}
}
if (s.endsWith(">")) {
s += " ";
}
return s + ">";
} Then if we want to attach an info to this function template: template <typename ModuleType, typename>
void f(ModuleType m); before it's instantiated, we use: new Info("f<ModuleType, typename>(ModuleType)") ( |
Yeah ok, still doesn't justify putting garbage in the map. It occurs to me that we could just put "typename arg0", etc, with a space in it, right? |
ok done |
Add support for anonymous type template parameters, such as:
We use a dummy name
[2]
as a key in the template map. If we usednull
or the empty string, we couldn't have more than 1 anonymous parameter.Regression tests: no change in existing presets.