aboutsummaryrefslogtreecommitdiff
path: root/Lib/java
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2019-03-01 18:01:14 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2019-03-01 18:01:14 +0000
commitbe491506a4036f627778b71641dff1fdf66b9a67 (patch)
tree2f9177da0f5b1f7736824e070b089a4e3cf26b28 /Lib/java
parent9e29ae16d2bb51e47b255867551c794a6e45817a (diff)
downloadswig-be491506a4036f627778b71641dff1fdf66b9a67.tar.gz
Java std::vector improvements for types that do not have a default constructor.
The std::vector wrappers have been changed to work by default for elements that are not default insertable, i.e. have no default constructor. This has been achieved by not wrapping: vector(size_type n); Previously the above had to be ignored via %ignore. If the above constructor is still required it can be added back in again via %extend: %extend std::vector { vector(size_type count) { return new std::vector< T >(count); } } Alternatively, the following wrapped constructor could be used as it provides near-enough equivalent functionality: vector(jint count, const value_type& value); The equivalent change to std::list has also been made (std::list wrappers were not in the previous release [3.0.12] though).
Diffstat (limited to 'Lib/java')
-rw-r--r--Lib/java/std_list.i5
-rw-r--r--Lib/java/std_vector.i5
2 files changed, 0 insertions, 10 deletions
diff --git a/Lib/java/std_list.i b/Lib/java/std_list.i
index 82ccde38b..1077bd0a0 100644
--- a/Lib/java/std_list.i
+++ b/Lib/java/std_list.i
@@ -198,11 +198,6 @@ namespace std {
%extend {
%fragment("SWIG_ListSize");
- list(jint count) throw (std::out_of_range) {
- if (count < 0)
- throw std::out_of_range("list count must be positive");
- return new std::list<T>(static_cast<std::list<T>::size_type>(count));
- }
list(jint count, const T &value) throw (std::out_of_range) {
if (count < 0)
diff --git a/Lib/java/std_vector.i b/Lib/java/std_vector.i
index f621e8992..88de46f46 100644
--- a/Lib/java/std_vector.i
+++ b/Lib/java/std_vector.i
@@ -94,11 +94,6 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
void clear();
%extend {
%fragment("SWIG_VectorSize");
- vector(jint count) throw (std::out_of_range) {
- if (count < 0)
- throw std::out_of_range("vector count must be positive");
- return new std::vector< CTYPE >(static_cast<std::vector< CTYPE >::size_type>(count));
- }
vector(jint count, const CTYPE &value) throw (std::out_of_range) {
if (count < 0)