Improve backwards compatibility in C# std::vector wrappers
For users who have typemaps for the parameters in the setitem method.
Correct definitions of const_reference to match the those in the
(C++11) standard.
diff --git a/Lib/csharp/std_vector.i b/Lib/csharp/std_vector.i
index e8eeb84..1e26037 100644
--- a/Lib/csharp/std_vector.i
+++ b/Lib/csharp/std_vector.i
@@ -233,15 +233,15 @@
else
throw std::out_of_range("index");
}
- CONST_REFERENCE getitem(int index) throw (std::out_of_range) {
+ const_reference getitem(int index) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size())
return (*$self)[index];
else
throw std::out_of_range("index");
}
- void setitem(int index, CTYPE const& value) throw (std::out_of_range) {
+ void setitem(int index, CTYPE const& val) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size())
- (*$self)[index] = value;
+ (*$self)[index] = val;
else
throw std::out_of_range("index");
}
@@ -351,7 +351,7 @@
%define SWIG_STD_VECTOR_ENHANCED(CTYPE...)
namespace std {
template<> class vector< CTYPE > {
- SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, %arg(CTYPE const&), %arg(CTYPE))
+ SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, %arg(CTYPE))
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE)
};
}
@@ -384,11 +384,11 @@
// primary (unspecialized) class template for std::vector
// does not require operator== to be defined
template<class T> class vector {
- SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, T const&, T)
+ SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, const value_type&, T)
};
// specialization for pointers
template<class T> class vector<T *> {
- SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, T *const&, T *)
+ SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, T *)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(T *)
};
// bool is specialized in the C++ standard - const_reference in particular