Add docs for C++11 ref-qualifiers

This commit is contained in:
William S Fulton 2017-08-25 22:52:56 +01:00
commit 330ef362f4
5 changed files with 150 additions and 6 deletions

View file

@ -2409,8 +2409,8 @@ the first renaming rule found on a depth-first traversal of the class hierarchy
is used.
</li>
<li><p>The name matching rules strictly follow member qualification rules.
For example, if you have a class like this:</p>
<li><p>The name matching rules strictly follow member qualifier rules.
For example, if you have a class and member with a member that is const qualified like this:</p>
<div class="code">
<pre>
@ -2434,7 +2434,7 @@ the declaration
</div>
<p>
will not apply as there is no unqualified member <tt>bar()</tt>. The following will apply as
will not apply as there is no unqualified member <tt>bar()</tt>. The following will apply the rename as
the qualifier matches correctly:
</p>
@ -2444,6 +2444,26 @@ the qualifier matches correctly:
</pre>
</div>
<p>
Similarly for combinations of cv-qualifiers and ref-qualifiers, all the qualifiers must be specified to match correctly:
</p>
<div class="code">
<pre>
%rename(name) Jam::bar(); // will not match
%rename(name) Jam::bar() &amp;; // will not match
%rename(name) Jam::bar() const; // will not match
%rename(name) Jam::bar() const &amp;; // ok, will match
class Jam {
public:
...
void bar() const &amp;;
...
};
</pre>
</div>
<p>
An often overlooked C++ feature is that classes can define two different overloaded members
that differ only in their qualifiers, like this:
@ -2476,7 +2496,7 @@ For example we can give them separate names in the target language:
<p>
Similarly, if you
merely wanted to ignore one of the declarations, use <tt>%ignore</tt>
with the full qualification. For example, the following directive
with the full qualifier. For example, the following directive
would tell SWIG to ignore the <tt>const</tt> version of <tt>bar()</tt>
above:
</p>