C++, add support for template introductions.

Thanks to mickk-on-cpp.
This commit is contained in:
Jakob Lykke Andersen
2016-05-30 23:18:10 +09:00
parent 74191207db
commit 8a64cfdd91
4 changed files with 191 additions and 33 deletions
+28
View File
@@ -739,6 +739,34 @@ parameters, or the keyword ``auto`` to introduce unconstrained template paramete
A function template with a single template parameter, constrained by the
Iterator concept.
Template Introductions
......................
Simple constrained function or class templates can be declared with a
`template introduction` instead of a template parameter list::
.. cpp:function:: std::Iterator{It} void advance(It &it)
A function template with a template parameter constrained to be an Iterator.
.. cpp:class:: std::LessThanComparable{T} MySortedContainer
A class template with a template parameter constrained to be LessThanComparable.
They are rendered as follows.
.. cpp:function:: std::Iterator{It} void advance(It &it)
A function template with a template parameter constrained to be an Iterator.
.. cpp:class:: std::LessThanComparable{T} MySortedContainer
A class template with a template parameter constrained to be LessThanComparable.
Note however that no checking is performed with respect to parameter
compatibility. E.g., ``Iterator{A, B, C}`` will be accepted as an introduction
even though it would not be valid C++.
Namespacing
~~~~~~~~~~~~~~~~~