Wrap std::list::empty as isEmpty in Java

This commit is contained in:
William S Fulton 2017-06-23 15:26:53 +01:00
commit 990c597365
2 changed files with 7 additions and 1 deletions

View file

@ -16,7 +16,12 @@ public class li_std_list_runme {
IntList v1 = new IntList(); IntList v1 = new IntList();
DoubleList v2 = new DoubleList(); DoubleList v2 = new DoubleList();
v1.add(123); if (!v1.isEmpty()) throw new RuntimeException("v1 test (1) failed");
if (v1.size() != 0) throw new RuntimeException("v1 test (2) failed");
if (!v1.add(123)) throw new RuntimeException("v1 test (3) failed");
if (v1.size() != 1) throw new RuntimeException("v1 test (4) failed");
if (v1.isEmpty()) throw new RuntimeException("v1 test (5) failed");
if (v1.get(0) != 123) throw new RuntimeException("v1 test failed"); if (v1.get(0) != 123) throw new RuntimeException("v1 test failed");
StructList v4 = new StructList(); StructList v4 = new StructList();

View file

@ -162,6 +162,7 @@ namespace std {
list(const list &o); list(const list &o);
~list(); ~list();
void assign(size_type n, const value_type &val); void assign(size_type n, const value_type &val);
%rename(isEmpty) empty;
bool empty() const; bool empty() const;
size_type max_size() const; size_type max_size() const;
void pop_back(); void pop_back();