- better support for classes with no default constructor, equal or

comparison methods.

  you will be able to do

    struct Foo {
     Foo(int) {}
    };

    %std_nodefconst_type(Foo); // Says Foo has no def. constructor

    %template(vector_Foo) std::vector<Foo>;

  and the conflicting vector/list/deque methods will not be generated.


more cosmetic, and a note about the relation between std::map and
std::pair.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5810 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-03-31 11:27:53 +00:00
commit 29a30e2dcc
10 changed files with 79 additions and 77 deletions

View file

@ -255,42 +255,37 @@ namespace swigpy
// __getitem__ is required to raise an IndexError for for-loops to work
// other methods which can raise are made to throw an IndexError as well
%exception __getitem__ {
try {
$action;
} catch (std::out_of_range& e) {
try { $action }
catch (std::out_of_range& e) {
SWIG_exception(SWIG_IndexError,const_cast<char*>(e.what()));
}
}
%exception __setitem__ {
try {
$action;
} catch (std::out_of_range& e) {
try { $action }
catch (std::out_of_range& e) {
SWIG_exception(SWIG_IndexError,const_cast<char*>(e.what()));
}
}
%exception __setslice__ {
try {
$action;
} catch (std::invalid_argument& e) {
try { $action }
catch (std::invalid_argument& e) {
SWIG_exception(SWIG_TypeError,const_cast<char*>(e.what()));
}
}
%exception __delitem__ {
try {
$action;
} catch (std::out_of_range& e) {
try { $action }
catch (std::out_of_range& e) {
SWIG_exception(SWIG_IndexError,const_cast<char*>(e.what()));
}
}
%exception pop {
try {
$action;
} catch (std::out_of_range& e) {
SWIG_exception(SWIG_IndexError,const_cast<char*>(e.what()));
try { $action }
catch (std::out_of_range& e) {
SWIG_exception(SWIG_IndexError,const_cast<char*>(e.what()));
}
}
@ -301,8 +296,7 @@ namespace swigpy
return !(self->empty());
}
size_type __len__() const
{
size_type __len__() const {
return self->size();
}
}