Java std::vector minor improvement
This commit is contained in:
parent
0b390a5473
commit
abe53e39a9
1 changed files with 5 additions and 5 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue