Skip to content

Commit 16d0771

Browse files
committed
Update for C++11 variadic templates
1 parent 52b7e6d commit 16d0771

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

articles/variadic-function-templates.dd

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ $(CONSOLE
2222
)
2323

2424
$(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++.
2726
Then, we'll do it the various ways the D programming
2827
language makes possible.
2928
)
@@ -97,12 +96,9 @@ template<class T1, class T2, class T3> void print(T1 a1, T2 a2, T3 a3)
9796
compilation.
9897
)
9998

100-
$(H4 The C++ Extension Solution)
99+
$(H4 C++ Variadic Templates)
101100

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:
106102
)
107103

108104
$(CCODE
@@ -120,12 +116,6 @@ template<class T, class... U> void print(T a1, U... an)
120116
$(P It uses recursive function template instantiation
121117
to pick off the arguments one by one.
122118
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.
129119
)
130120

131121
$(H3 D Programming Language Solutions)
@@ -162,7 +152,7 @@ void print(...)
162152
$(H4 Translating the Variadic C++ Solution into D)
163153

164154
$(P Variadic templates in D enable a straightforward translation
165-
of the proposed C++ variadic syntax:
155+
of the C++11 variadic solution:
166156
)
167157

168158
---

0 commit comments

Comments
 (0)