diff options
author | Markus Friedrich <friedrich.at.gc@googlemail.com> | 2022-09-18 20:19:39 +0200 |
---|---|---|
committer | Markus Friedrich <friedrich.at.gc@googlemail.com> | 2022-09-18 20:19:39 +0200 |
commit | d1b7765838c2145e8c6fb545d46075298f2ee2a8 (patch) | |
tree | a2a38b678a0aafdbd36da1c03f448b7b7814f37d /Doc | |
parent | 720c28f1ed068b17a5df89e2571a1208b79f5e22 (diff) | |
download | swig-d1b7765838c2145e8c6fb545d46075298f2ee2a8.tar.gz |
Extended the documentation for octave operator overloading
Octave has more operators than C++. These operators can be overloaded for
the type swig_ref using the standard Octave Object Oriented Programming mechanism.
This is now added to the documentation.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/Manual/Octave.html | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/Manual/Octave.html b/Doc/Manual/Octave.html index de39a1d96..b5168b899 100644 --- a/Doc/Manual/Octave.html +++ b/Doc/Manual/Octave.html @@ -625,6 +625,16 @@ On the C++ side, the default mappings are as follows: Octave can also utilise friend (i.e. non-member) operators with a simple %rename: see the example in the Examples/octave/operator directory. </p> +<p> +Octave has several operators for which no corresponding C++ operators exist. For example, the Octave code +</p> +<div class="targetlang"><pre> +x=[a,b,c]; +</pre></div> +<p> +calls the Octave operator <tt>horzcat</tt> of the class of <tt>a</tt>. Hence, if <tt>a</tt> is of type <tt>swig_ref</tt> you can write an overload for this operator for your wrapped C++ class by placing a file <tt>@swig_ref/horzcat.m</tt> in the Octave load path (like for every Octave class, see <a href="https://docs.octave.org/latest/Creating-a-Class.html">Creating a Class</a>). This Octave function file is then called whenever the above Octave code is executed for a variable of type <tt>swig_ref</tt>. +</p> + <H3><a name="Octave_nn19">30.3.10 Class extension with %extend</a></H3> |