Java std::vector minor improvement

This commit is contained in:
William S Fulton 2017-06-29 20:19:59 +01:00
commit abe53e39a9

View file

@ -109,7 +109,7 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
}
void doAdd(jint index, const value_type& value) throw (std::out_of_range) {
const jint size = SWIG_VectorSize(self->size());
const jint size = static_cast<std::vector< CTYPE >::size_type>(self->size());
if (0 <= index && index <= size) {
self->insert(self->begin() + index, value);
} else {
@ -118,7 +118,7 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
}
value_type doRemove(jint index) throw (std::out_of_range) {
const jint size = SWIG_VectorSize(self->size());
const jint size = static_cast<std::vector< CTYPE >::size_type>(self->size());
if (0 <= index && index < size) {
CTYPE const old_value = (*self)[index];
self->erase(self->begin() + index);
@ -129,7 +129,7 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
}
CREF_TYPE doGet(jint index) throw (std::out_of_range) {
const jint size = SWIG_VectorSize(self->size());
const jint size = static_cast<std::vector< CTYPE >::size_type>(self->size());
if (index >= 0 && index < size)
return (*self)[index];
else
@ -137,7 +137,7 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
}
value_type doSet(jint index, const value_type& value) throw (std::out_of_range) {
const jint size = SWIG_VectorSize(self->size());
const jint size = static_cast<std::vector< CTYPE >::size_type>(self->size());
if (index >= 0 && index < size) {
CTYPE const old_value = (*self)[index];
(*self)[index] = value;
@ -148,7 +148,7 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
}
void doRemoveRange(jint fromIndex, jint toIndex) throw (std::out_of_range) {
const jint size = SWIG_VectorSize(self->size());
const jint size = static_cast<std::vector< CTYPE >::size_type>(self->size());
if (0 <= fromIndex && fromIndex <= toIndex && toIndex <= size) {
self->erase(self->begin() + fromIndex, self->begin() + toIndex);
} else {