diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2019-04-19 00:11:22 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2019-04-19 00:11:22 +0100 |
commit | c79cf790853d6e6d65aa7379ccb2e472b704e456 (patch) | |
tree | 80f8461ebe0b482720692bfaf4bb408febd23ca1 /Lib/csharp | |
parent | 05c8c972cc32c11bc4adbbfd45e73cd7bf97495f (diff) | |
download | swig-c79cf790853d6e6d65aa7379ccb2e472b704e456.tar.gz |
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.
Diffstat (limited to 'Lib/csharp')
-rw-r--r-- | Lib/csharp/std_vector.i | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/csharp/std_vector.i b/Lib/csharp/std_vector.i index e8eeb8411..1e2603782 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 @@ namespace std { // 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 |