This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[wwwdocs] Mention generic functions and explicit lambda templates in gcc-4.9/changes
- From: Adam Butcher <adam at jessamine dot co dot uk>
- To: Gcc Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jason Merrill <jason at redhat dot com>
- Date: Tue, 29 Apr 2014 03:15:46 +0100
- Subject: [wwwdocs] Mention generic functions and explicit lambda templates in gcc-4.9/changes
- Authentication-results: sourceware.org; auth=none
Hi,
The following patch adds details of support for generic functions and
the explicit template parameter extension for generic lambdas present in
GCC 4.9.
OK to commit?
Cheers,
Adam
Index: htdocs/gcc-4.9/changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.9/changes.html,v
retrieving revision 1.68
diff -u -r1.68 changes.html
--- htdocs/gcc-4.9/changes.html 22 Apr 2014 11:28:09 -0000 1.68
+++ htdocs/gcc-4.9/changes.html 29 Apr 2014 02:10:39 -0000
@@ -273,12 +273,37 @@
</pre></blockquote>
</li>
<li>
- G++ supports <a href="../projects/cxx1y.html">C++1y</a>
polymorphic lambdas.
+ G++ supports <a href="../projects/cxx1y.html">C++1y</a>
+ generic (polymorphic) lambdas.
<blockquote><pre>
// a functional object that will increment any type
auto incr = [](auto x) { return x++; };
</pre></blockquote>
</li>
+ <li>
+ As a GNU extension, G++ supports explicit template parameter
+ syntax for generic lambdas. This can be combined in the expected
+ way with the standard <code>auto</code> syntax.
+<blockquote><pre>
+// a functional object that will add two like-type objects
+auto add = [] <typename T> (T a, T b) { return a + b; };
+</pre></blockquote>
+ </li>
+ <li>
+ G++ supports unconstrained <em>generic functions</em> as specified
+ by §4.1.2 and §5.1.1 of
+ <a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3889.pdf">
+ N3889: Concepts Lite Specification</a>. Briefly,
+ <code>auto</code> may be used as a type-specifier in a parameter
+ declaration of any function declarator in order to introduce an
+ implicit function template parameter, akin to generic lambdas.
+<blockquote><pre>
+// the following two function declarations are equivalent
+auto incr(auto x) { return x++; }
+template <typename T>
+auto incr(T x) { return x++; }
+</pre></blockquote>
+ </li>
</ul>
<h4>Runtime Library (libstdc++)</h4>