summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Thielemans <KrisThielemans@users.noreply.github.com>2022-03-06 17:34:26 +0000
committerGitHub <noreply@github.com>2022-03-07 06:34:26 +1300
commitbb368628722f49c1b9e1f00ae3628b821724356d (patch)
tree89650c6ff0c2bcfeae9992ed3fbe0ee4830b5640
parent27bdbc1f05c7c656c9d0cafdea225ab3cf017f89 (diff)
downloadswig-bb368628722f49c1b9e1f00ae3628b821724356d.tar.gz
add doc on %attribute and templates (#2224)
Document behaviour found in #2142
-rw-r--r--Doc/Manual/Library.html23
1 files changed, 22 insertions, 1 deletions
diff --git a/Doc/Manual/Library.html b/Doc/Manual/Library.html
index 896cb217b..9f606fa3f 100644
--- a/Doc/Manual/Library.html
+++ b/Doc/Manual/Library.html
@@ -45,6 +45,9 @@
<ul>
<li><a href="#Library_nn17">exception.i</a>
<li><a href="#Library_attributes">attribute.i</a>
+<ul>
+<li><a href="#Library_attribute_templates">&percnt;attribute and C++ templates</a></li>
+</ul>
</ul>
</ul>
</div>
@@ -2327,6 +2330,24 @@ shared_ptr which has <tt>%naturalvar</tt> turned on in
<tt>%shared_ptr</tt>.
</p>
-
+<H4><a name="Library_attribute_templates">12.5.2.1 %attribute and C++ templates</a></H4>
+<p>
+ <tt>%attribute</tt> and friends have to be used on fully specified classes. For example
+</p>
+<div class="code">
+<pre>
+%attributeref(A&lt;int&gt;, int, a);
+%inline %{
+ template &lt;class T&gt; struct A {
+ T a() const;
+ void a(T &);
+ };
+%}
+</pre>
+</div>
+<p>
+Note the use of a template-id (i.e., <tt>A&lt;int&gt;</tt> not <tt>A&lt;T&gt;</tt> or just <tt>A</tt>).
+This means that <tt>%attribute</tt> statements have to be repeated for any template-id that you want to use with <tt>%template</tt>.
+</p>
</body>
</html>