@@ -22,8 +22,7 @@ $(CONSOLE
22
22
)
23
23
24
24
$(P We'll explore how this can
25
- be done in standard C++, followed by doing it using
26
- the proposed variadic template C++ extension.
25
+ be done in C++.
27
26
Then, we'll do it the various ways the D programming
28
27
language makes possible.
29
28
)
@@ -97,12 +96,9 @@ template<class T1, class T2, class T3> void print(T1 a1, T2 a2, T3 a3)
97
96
compilation.
98
97
)
99
98
100
- $(H4 The C++ Extension Solution )
99
+ $(H4 C++ Variadic Templates )
101
100
102
- $(P Douglas Gregor has proposed a
103
- variadic template scheme [1]
104
- for C++ that solves these problems.
105
- The result looks like:
101
+ $(P C++11 supports variadic templates:
106
102
)
107
103
108
104
$(CCODE
@@ -120,12 +116,6 @@ template<class T, class... U> void print(T a1, U... an)
120
116
$(P It uses recursive function template instantiation
121
117
to pick off the arguments one by one.
122
118
A specialization with no arguments ends the recursion.
123
- It's a neat and tidy solution, but with one glaring problem:
124
- it's a proposed extension, which means it isn't part
125
- of the C++ standard, may not get into the C++ standard
126
- in its current form, may not get into the standard
127
- in any form, and even if it does, it may be many, many
128
- years before the feature is commonly implemented.
129
119
)
130
120
131
121
$(H3 D Programming Language Solutions)
@@ -162,7 +152,7 @@ void print(...)
162
152
$(H4 Translating the Variadic C++ Solution into D)
163
153
164
154
$(P Variadic templates in D enable a straightforward translation
165
- of the proposed C++ variadic syntax :
155
+ of the C++11 variadic solution :
166
156
)
167
157
168
158
---
0 commit comments