diff options
Diffstat (limited to 'Lib/csharp/std_vector.i')
-rw-r--r-- | Lib/csharp/std_vector.i | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/Lib/csharp/std_vector.i b/Lib/csharp/std_vector.i index e2811290c..982306e0d 100644 --- a/Lib/csharp/std_vector.i +++ b/Lib/csharp/std_vector.i @@ -19,7 +19,7 @@ // MACRO for use within the std::vector class body %define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...) -%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n"; +%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n" %proxycode %{ public $csclassname(global::System.Collections.IEnumerable c) : this() { if (c == null) @@ -63,12 +63,18 @@ return (int)capacity(); } set { - if (value < size()) + if (value < 0 || ($typemap(cstype, size_t))value < size()) throw new global::System.ArgumentOutOfRangeException("Capacity"); reserve(($typemap(cstype, size_t))value); } } + public bool IsEmpty { + get { + return empty(); + } + } + public int Count { get { return (int)size(); @@ -203,19 +209,20 @@ typedef value_type& reference; typedef CONST_REFERENCE const_reference; + vector(); + vector(const vector &other); + %rename(Clear) clear; void clear(); %rename(Add) push_back; void push_back(CTYPE const& x); size_type size() const; + bool empty() const; size_type capacity() const; void reserve(size_type n); %newobject GetRange(int index, int count); %newobject Repeat(CTYPE const& value, int count); - vector(); - vector(const vector &other); - %extend { vector(int capacity) throw (std::out_of_range) { std::vector< CTYPE >* pv = 0; @@ -357,22 +364,13 @@ namespace std { } %enddef -// Legacy macros -%define SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE...) -#warning SWIG_STD_VECTOR_SPECIALIZE macro deprecated, please see csharp/std_vector.i and switch to SWIG_STD_VECTOR_ENHANCED -SWIG_STD_VECTOR_ENHANCED(CTYPE) -%enddef - -%define SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(CSTYPE, CTYPE...) -#warning SWIG_STD_VECTOR_SPECIALIZE_MINIMUM macro deprecated, it is no longer required -%enddef - %{ #include <vector> #include <algorithm> #include <stdexcept> %} +%csmethodmodifiers std::vector::empty "private" %csmethodmodifiers std::vector::getitemcopy "private" %csmethodmodifiers std::vector::getitem "private" %csmethodmodifiers std::vector::setitem "private" @@ -415,4 +413,3 @@ SWIG_STD_VECTOR_ENHANCED(float) SWIG_STD_VECTOR_ENHANCED(double) SWIG_STD_VECTOR_ENHANCED(std::string) // also requires a %include <std_string.i> SWIG_STD_VECTOR_ENHANCED(std::wstring) // also requires a %include <std_wstring.i> - |