summaryrefslogtreecommitdiff
path: root/Lib/java
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2019-04-18 23:24:43 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2019-04-18 23:24:43 +0100
commit05c8c972cc32c11bc4adbbfd45e73cd7bf97495f (patch)
treefa5fe6444d3b8b75144db7779cb5c60d0c2158a3 /Lib/java
parentb6a675cf1d471a2341258f9f56c783cf8e3b4768 (diff)
downloadswig-05c8c972cc32c11bc4adbbfd45e73cd7bf97495f.tar.gz
Improve backwards compatibility in Java std::vector wrappers
For users who have typemaps for the parameters in the add and set methods (now called doAdd and doSet). Also for users who have typemaps for the get method - revert the return type for get (now called doGet) back to the same return type as std::vector::at. Correct definitions of const_reference to match the those in the (C++11) standard.
Diffstat (limited to 'Lib/java')
-rw-r--r--Lib/java/std_vector.i16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/java/std_vector.i b/Lib/java/std_vector.i
index 88de46f46..e33270238 100644
--- a/Lib/java/std_vector.i
+++ b/Lib/java/std_vector.i
@@ -105,14 +105,14 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
return SWIG_VectorSize(self->size());
}
- void doAdd(const value_type& value) {
- self->push_back(value);
+ void doAdd(const value_type& x) {
+ self->push_back(x);
}
- void doAdd(jint index, const value_type& value) throw (std::out_of_range) {
+ void doAdd(jint index, const value_type& x) throw (std::out_of_range) {
jint size = static_cast<jint>(self->size());
if (0 <= index && index <= size) {
- self->insert(self->begin() + index, value);
+ self->insert(self->begin() + index, x);
} else {
throw std::out_of_range("vector index out of range");
}
@@ -129,7 +129,7 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
}
}
- CONST_REFERENCE doGet(jint index) throw (std::out_of_range) {
+ const_reference doGet(jint index) throw (std::out_of_range) {
jint size = static_cast<jint>(self->size());
if (index >= 0 && index < size)
return (*self)[index];
@@ -137,11 +137,11 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
throw std::out_of_range("vector index out of range");
}
- value_type doSet(jint index, const value_type& value) throw (std::out_of_range) {
+ value_type doSet(jint index, const value_type& val) throw (std::out_of_range) {
jint size = static_cast<jint>(self->size());
if (index >= 0 && index < size) {
CTYPE const old_value = (*self)[index];
- (*self)[index] = value;
+ (*self)[index] = val;
return old_value;
}
else
@@ -169,7 +169,7 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
namespace std {
template<class T> class vector {
- SWIG_STD_VECTOR_MINIMUM_INTERNAL(T, const T&)
+ SWIG_STD_VECTOR_MINIMUM_INTERNAL(T, const value_type&)
};
// bool specialization