File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1082,6 +1082,23 @@ $(H2 $(LNAME2 function-templates, Function Templates))
1082
1082
}
1083
1083
---
1084
1084
1085
+ $(P Variadic Function Templates can have parameters with default values.
1086
+ These parameters are always set to their default value in case of IFTI.
1087
+ )
1088
+
1089
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1090
+ ---
1091
+ size_t fun(T...)(T t, string file = __FILE__)
1092
+ {
1093
+ import std.stdio;
1094
+ writeln(file, " ", t);
1095
+ return T.length;
1096
+ }
1097
+ assert(fun(1, "foo") == 2); // uses IFTI
1098
+ assert(fun!int(1, "foo") == 1); // no IFTI
1099
+ ---
1100
+ )
1101
+
1085
1102
$(H2 $(LNAME2 variable-template, Variable Templates))
1086
1103
1087
1104
$(P Same as aggregates and functions, variable declarations with
You can’t perform that action at this time.
0 commit comments