summaryrefslogtreecommitdiff
path: root/Examples/test-suite/java
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2022-07-08 08:34:45 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2022-07-08 17:41:15 +0100
commite777b054d583aaf2ed445a263208c6ef21bc05ac (patch)
tree071c0ee9d9ee1b36bf648f3d575b51b59087b1a8 /Examples/test-suite/java
parent1ece69cafd417b2936347686df8482a26eadb90e (diff)
downloadswig-e777b054d583aaf2ed445a263208c6ef21bc05ac.tar.gz
Performance optimisation for parameters passed by value that are C++11 movable.
The C++ wrappers create a temporary variable for a parameter to be passed to a function. This is initially default constructed and then copy assigned from the instance being passed in from the target language. This is unchanged, however, when the temporary variable is passed to wrapped function, it is now done using std::move. If the type is move constructible, the move constructor will be used instead of the copy constructor. Note that the implementation calls std::move for all user-defined types (non-primitive types passed by value), this excludes anything passed by pointer, reference and arrays. It does also include any type that has not been defined/parsed by SWIG, that is, unknown types. std::move is called via the SWIG_STD_MOVE macro which only calls std::move for C++11 and later code.
Diffstat (limited to 'Examples/test-suite/java')
-rw-r--r--Examples/test-suite/java/cpp11_move_only_runme.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/Examples/test-suite/java/cpp11_move_only_runme.java b/Examples/test-suite/java/cpp11_move_only_runme.java
index e1d7cf180..8f0f2acef 100644
--- a/Examples/test-suite/java/cpp11_move_only_runme.java
+++ b/Examples/test-suite/java/cpp11_move_only_runme.java
@@ -43,9 +43,9 @@ public class cpp11_move_only_runme {
MovableCopyable mo = new MovableCopyable(222);
Counter.check_counts(1, 0, 0, 0, 0, 0);
MovableCopyable.take(mo);
- Counter.check_counts(2, 1, 1, 0, 0, 2);
+ Counter.check_counts(2, 0, 1, 1, 0, 2);
mo.delete();
- Counter.check_counts(2, 1, 1, 0, 0, 3);
+ Counter.check_counts(2, 0, 1, 1, 0, 3);
}
}
}