Fix removing elements from std::list Java wrapper
Add missing remove method on Java side (without it elements aren't removed).
This commit is contained in:
parent
428b332e68
commit
2d99027935
2 changed files with 18 additions and 0 deletions
|
|
@ -37,6 +37,22 @@ public class li_std_list_runme {
|
||||||
if (v1.size() != 1) throw new RuntimeException("v1 test (7) failed");
|
if (v1.size() != 1) throw new RuntimeException("v1 test (7) failed");
|
||||||
if (v1.get(0) != 456) throw new RuntimeException("v1 test (8) failed");
|
if (v1.get(0) != 456) throw new RuntimeException("v1 test (8) failed");
|
||||||
|
|
||||||
|
java.util.Iterator<Integer> v1_iterator = v1.iterator();
|
||||||
|
if (!v1_iterator.hasNext()) throw new RuntimeException("v1 test (9) failed");
|
||||||
|
if (v1_iterator.next() != 456) throw new RuntimeException("v1 test (10) failed");
|
||||||
|
if (v1_iterator.hasNext()) throw new RuntimeException("v1 test (11) failed");
|
||||||
|
try {
|
||||||
|
v1_iterator.next();
|
||||||
|
throw new RuntimeException("v1 test (12) failed");
|
||||||
|
} catch (java.util.NoSuchElementException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (v1.remove(new Integer(123))) throw new RuntimeException("v1 test (13) failed");
|
||||||
|
if (!v1.remove(new Integer(456))) throw new RuntimeException("v1 test (14) failed");
|
||||||
|
if (!v1.isEmpty()) throw new RuntimeException("v1 test (15) failed");
|
||||||
|
if (v1.size() != 0) throw new RuntimeException("v1 test (16) failed");
|
||||||
|
if (v1.remove(new Integer(456))) throw new RuntimeException("v1 test (17) failed");
|
||||||
|
|
||||||
StructList v4 = new StructList();
|
StructList v4 = new StructList();
|
||||||
StructPtrList v5 = new StructPtrList();
|
StructPtrList v5 = new StructPtrList();
|
||||||
StructConstPtrList v6 = new StructConstPtrList();
|
StructConstPtrList v6 = new StructConstPtrList();
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,8 @@ namespace std {
|
||||||
%rename(isEmpty) empty;
|
%rename(isEmpty) empty;
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
void clear();
|
void clear();
|
||||||
|
%rename(remove) erase;
|
||||||
|
iterator erase(iterator pos);
|
||||||
size_type max_size() const;
|
size_type max_size() const;
|
||||||
void pop_back();
|
void pop_back();
|
||||||
void pop_front();
|
void pop_front();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue