add doc on %attribute and templates (#2224)

Document behaviour found in #2142
This commit is contained in:
Kris Thielemans 2022-03-06 17:34:26 +00:00 committed by GitHub
parent 27bdbc1f05
commit bb36862872
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 1 deletions

View File

@ -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>