diff --git a/Doc/Manual/Scilab.html b/Doc/Manual/Scilab.html index 9b321f2e3..f98dc387d 100644 --- a/Doc/Manual/Scilab.html +++ b/Doc/Manual/Scilab.html @@ -960,6 +960,63 @@ But we can use either use the get_perimeter() function of the parent cl
+As in other languages, function and class templates are supported in SWIG Scilab. +
+ ++You have to tell SWIG to create wrappers for a particular +template instantiation. The %template directive is used for that purpose. +For example: +
+ +
+%module example
+
+template<class T1, class T2, class T3>
+struct triplet {
+ T1 first;
+ T2 second;
+ T3 third;
+ triplet(const T1& a, const T2& b, const T3& c) {
+ third = a; second = b; third = c;
+ }
+};
+
+%template(IntTriplet) triplet<int,int,int>;
++Then in Scilab: +
+ ++-->t = new_IntTriplet(3, 4, 1); + +-->IntTriplet_first_get(t) + ans = + + 3. + +-->IntTriplet_second_get(t) + ans = + + 4. + +-->IntTriplet_third_get(t) + ans = + + 1. + +-->delete_IntTriplet(t); ++
+More details on template support can be found in the SWIG C++ documentation. +
+
Templates are supported. See the SWIG general documentation on how templates are interfaced in SWIG.
An example of templates can be found in Examples/scilab/templates.