merge revisions 11243-11872 from trunk to gsoc2009-matevz

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@12162 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-07-20 21:58:41 +00:00
commit ab1cd03979
387 changed files with 12383 additions and 4412 deletions

View file

@ -24,7 +24,7 @@
};
*/
%define %std_deque_methods(T)
%define %std_deque_methods_noempty(T)
typedef T &reference;
typedef const T& const_reference;
@ -38,7 +38,6 @@
unsigned int size() const;
unsigned int max_size() const;
void resize(unsigned int n, T c = T());
bool empty() const;
const_reference front();
const_reference back();
void push_front(const T& x);
@ -66,7 +65,7 @@
throw std::out_of_range("deque index out of range");
}
void delitem(int i) throw (std::out_of_range) {
int size = int(self->size());
int size = int(self->size());
if (i<0) i+= size;
if (i>=0 && i<size) {
self->erase(self->begin()+i);
@ -74,7 +73,7 @@
throw std::out_of_range("deque index out of range");
}
}
std::deque<T> getslice(int i, int j) {
std::deque<T> getslice(int i, int j) {
int size = int(self->size());
if (i<0) i = size+i;
if (j<0) j = size+j;
@ -109,15 +108,27 @@
self->erase(self->begin()+i,self->begin()+j);
}
};
%enddef
#ifdef SWIGPHP
%define %std_deque_methods(T)
%extend {
bool is_empty() const {
return self->empty();
}
};
%std_deque_methods_noempty(T)
%enddef
#else
%define %std_deque_methods(T)
bool empty() const;
%std_deque_methods_noempty(T)
%enddef
#endif
namespace std {
template<class T> class deque {
public:
%std_deque_methods(T);
};
}

View file

@ -134,6 +134,46 @@ namespace std {
%std_vector_methods_val(vector);
};
// ***
// const pointer specialization
// ***
template<class _Tp, class _Alloc >
class vector<const _Tp *, _Alloc > {
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef const _Tp * value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type reference;
typedef value_type const_reference;
typedef _Alloc allocator_type;
%traits_swigtype(_Tp);
%fragment(SWIG_Traits_frag(std::vector<const _Tp *, _Alloc >), "header",
fragment=SWIG_Traits_frag(_Tp),
fragment="StdVectorTraits") {
namespace swig {
template <> struct traits<std::vector<const _Tp *, _Alloc > > {
typedef value_category category;
static const char* type_name() {
return "std::vector<const " #_Tp " *," #_Alloc " >";
}
};
}
}
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<const _Tp *, _Alloc >);
#ifdef %swig_vector_methods_val
// Add swig/language extra methods
%swig_vector_methods_val(std::vector<const _Tp *, _Alloc >);
#endif
%std_vector_methods_val(vector);
};
// ***
// ***
// bool specialization