From 485a4e8b6a376493cfb5eb52e2bd256f0392b37d Mon Sep 17 00:00:00 2001
From: William S Fulton
Further details can be obtained from the Java exception handling section.
+
-As can be seen, the intended use for the %feature directive is as a highly flexible customization mechanism that can be used to annotate
+SWIG treats methods with default arguments as separate overloaded methods as detailed
+in the default arguments section.
+Any %feature targeting a method with default arguments
+will apply to all the extra overloaded methods that SWIG generates if the
+default arguments are specified in the feature. If the default arguments are
+not specified in the feature, then the feature will match that exact
+wrapper method only and not the extra overloaded methods that SWIG generates.
+For example:
+
+will apply the feature to all three wrapper methods, that is:
+
+If the default arguments are not specified in the feature:
+
+then the feature will only apply to this wrapper method:
+
+and not these wrapper methods:
+
+If compactdefaultargs are being used, then the difference between
+specifying or not specifying default arguments in a feature is not applicable as just one wrapper is generated.
+
+Compatibility note: The different behaviour of features specified with or without default arguments was introduced
+in SWIG-1.3.23 when the approach to wrapping methods with default arguments was changed.
+
+As has been shown earlier, the intended use for the %feature directive is as a highly flexible customization mechanism that can be used to annotate
declarations with additional information for use by specific target language modules. Another example is
in the Python module. You might use %feature to rewrite proxy/shadow class code as follows:
11.3.1 Features and default arguments
+
+
+
+
+%feature("except") void hello(int i=0, double d=0.0);
+void hello(int i=0, double d=0.0);
+
+
+
+
+
+void hello(int i, double d);
+void hello(int i);
+void hello();
+
+
+
+
+
+%feature("except") void hello(int i, double d);
+void hello(int i=0, double d=0.0);
+
+
+
+
+
+void hello(int i, double d);
+
+
+
+
+
+void hello(int i);
+void hello();
+
+11.3.2 Feature example
+
+
+
+Please see the Features and default arguments +section for more information on using %feature for functions with default arguments. +
+Compatibility note: Versions of SWIG prior to SWIG-1.3.23 wrapped default arguments slightly differently. Instead a single wrapper method was generated and the default values were copied into the C++ wrappers