Python builtin - add indexing support to std::set
This commit is contained in:
parent
4715a4e72c
commit
05d6717de9
2 changed files with 5 additions and 3 deletions
|
|
@ -54,6 +54,8 @@ if i.next() != 2:
|
||||||
if i.next() != 3:
|
if i.next() != 3:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
if si[0] != 1:
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
i = s.begin()
|
i = s.begin()
|
||||||
i.next()
|
i.next()
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,11 @@
|
||||||
%swig_container_methods(set);
|
%swig_container_methods(set);
|
||||||
|
|
||||||
#if defined(SWIGPYTHON_BUILTIN)
|
#if defined(SWIGPYTHON_BUILTIN)
|
||||||
|
%feature("python:slot", "mp_subscript", functype="binaryfunc") __getitem__;
|
||||||
%feature("python:slot", "sq_contains", functype="objobjproc") __contains__;
|
%feature("python:slot", "sq_contains", functype="objobjproc") __contains__;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
%extend {
|
%extend {
|
||||||
void append(value_type x) {
|
void append(value_type x) {
|
||||||
self->insert(x);
|
self->insert(x);
|
||||||
}
|
}
|
||||||
|
|
@ -60,8 +61,7 @@
|
||||||
void discard(value_type x) {
|
void discard(value_type x) {
|
||||||
self->erase(x);
|
self->erase(x);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
%include <std/std_set.i>
|
%include <std/std_set.i>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue