This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[wwwdocs] Mention generic functions and explicit lambda templates in gcc-4.9/changes


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 = [] &lt;typename T&gt; (T a, T b) { return a + b; };
+</pre></blockquote>
+  </li>
+  <li>
+    G++ supports unconstrained <em>generic functions</em> as specified
+    by &sect;4.1.2 and &sect;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 &lt;typename T&gt;
+auto incr(T x) { return x++; }
+</pre></blockquote>
+  </li>
 </ul>

   <h4>Runtime Library (libstdc++)</h4>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]