From b416beb9e31fc2dc99ecdee7bfb27efab363119d Mon Sep 17 00:00:00 2001 From: Luigi Ballabio Date: Wed, 2 Apr 2003 07:41:56 +0000 Subject: [PATCH] Miscellaneous patches from users git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4654 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/ocaml/std_list.i | 2 +- Lib/python/std_list.i | 2 +- Lib/python/std_vector.i | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Lib/ocaml/std_list.i b/Lib/ocaml/std_list.i index c781f7094..8cf5354e4 100644 --- a/Lib/ocaml/std_list.i +++ b/Lib/ocaml/std_list.i @@ -204,7 +204,7 @@ namespace std{ } else { self->erase(first,end); - if (i+1 <= self->size()) + if (i+1 <= int(self->size())) { first = self->begin(); for (int k=0;kerase(first,end); - if (i+1 <= self->size()) + if (i+1 <= int(self->size())) { first = self->begin(); for (int k=0;k expected"); + throw SWIG_DIRECTOR_TYPE_MISMATCH( + "vector<" #T "> expected"); } } } else if (SWIG_ConvertPtr($input,(void **) &v, @@ -306,8 +307,9 @@ namespace std { if (j<0) j = size+j; if (i<0) i = 0; if (j>size) j = size; - std::vector tmp(j-i); - std::copy(self->begin()+i,self->begin()+j,tmp.begin()); + std::vector tmp; + tmp.reserve(j-i); + tmp.insert(tmp.begin(),self->begin()+i,self->begin()+j); return tmp; } void __setitem__(int i, const T& x) { @@ -902,7 +904,7 @@ namespace std { specialize_std_vector(unsigned short,PyInt_Check,\ PyInt_AsLong,PyInt_FromLong); specialize_std_vector(unsigned long,PyLong_Check,\ - PyLong_AsUnsignedLong,PyLong_UnsignedLong); + PyLong_AsUnsignedLong,PyLong_FromUnsignedLong); specialize_std_vector(double,SwigNumber_Check,\ SwigNumber_AsDouble,PyFloat_FromDouble); specialize_std_vector(float,SwigNumber_Check,\