Use swig::PyObject_ptr name instead of swig::PyItem

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7826 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-11-08 16:01:15 +00:00
commit 7c8bf2d69e
4 changed files with 17 additions and 10 deletions

View file

@ -113,13 +113,13 @@ Version 1.3.28 (unreleased)
But since normal C++ containers do not properly ref/unref
their items, you should use the safer versions:
%template(pyset) std::set<swig::PyItem>;
%template(pyvector) std::vector<swig::PyItem>;
%template() std::pair<swig::PyItem, swig::PyItem>;
%template(pyvector) std::map<swig::PyItem,swig::PyItem>;
%template(pyset) std::set<swig::PyObject_ptr>;
%template(pyvector) std::vector<swig::PyObject_ptr>;
%template() std::pair<swig::PyObject_ptr, swig::PyObject_ptr>;
%template(pyvector) std::map<swig::PyObject_ptr,swig::PyObject_ptr>;
....
where swig::PyItem is a PyObject * envelope class provided
where swig::PyObject_ptr is a PyObject * envelope class provided
to safely incref/decref the python object.
So, now you can use all the STL/STD containers as native
@ -248,7 +248,14 @@ Version 1.3.28 (unreleased)
swig-1.3.26 0.80s
swig-CVS 0.60s
Hence, now the proxy overhead is almost insignificant.
Hence, now for practical porpuses, the proxy overhead
is insignificant.
Note that the performance numbers we are showing is for
a simple module (two types) and a simple function (one
argument). For real situations, with modules with many
more types and/or functions with many more parameters,
you will see even better results.
10/31/2005: mmatus

View file

@ -29,8 +29,8 @@ namespace std
%template(pairiiAc) pair<int,const pair<int, A*> >;
%template() pair<swig::PyItem, swig::PyItem>;
%template(pymap) map<swig::PyItem, swig::PyItem>;
%template() pair<swig::PyObject_ptr, swig::PyObject_ptr>;
%template(pymap) map<swig::PyObject_ptr, swig::PyObject_ptr>;
}

View file

@ -14,4 +14,4 @@
%template(pyset) std::set<swig::PyItem>;
%template(pyset) std::set<swig::PyObject_ptr>;

View file

@ -121,4 +121,4 @@ std::vector<std::string> vecStr(std::vector<std::string> v) {
%array_functions(int,ArrInt)
%template(pyvector) std::vector<swig::PyItem>;
%template(pyvector) std::vector<swig::PyObject_ptr>;