Fix std::vector of const pointers

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11704 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-10-20 18:22:16 +00:00
commit 132376bade
5 changed files with 67 additions and 2 deletions

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