aboutsummaryrefslogtreecommitdiff
path: root/Lib/csharp/std_map.i
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/csharp/std_map.i')
-rw-r--r--Lib/csharp/std_map.i30
1 files changed, 14 insertions, 16 deletions
diff --git a/Lib/csharp/std_map.i b/Lib/csharp/std_map.i
index e538a03a1..4f447422a 100644
--- a/Lib/csharp/std_map.i
+++ b/Lib/csharp/std_map.i
@@ -26,7 +26,7 @@
/* K is the C++ key type, T is the C++ value type */
%define SWIG_STD_MAP_INTERNAL(K, T, C)
-%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n";
+%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n"
%proxycode %{
public $typemap(cstype, T) this[$typemap(cstype, K) key] {
@@ -48,6 +48,12 @@
return false;
}
+ public bool IsEmpty {
+ get {
+ return empty();
+ }
+ }
+
public int Count {
get {
return (int)size();
@@ -236,7 +242,11 @@
}
void setitem(const key_type& key, const mapped_type& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*$self).insert_or_assign(key, x);
+%#else
(*$self)[key] = x;
+%#endif
}
bool ContainsKey(const key_type& key) {
@@ -269,12 +279,14 @@
}
const key_type& get_next_key(std::map< K, T, C >::iterator *swigiterator) {
+ (void)$self;
std::map< K, T, C >::iterator iter = *swigiterator;
(*swigiterator)++;
return (*iter).first;
}
void destroy_iterator(std::map< K, T, C >::iterator *swigiterator) {
+ (void)$self;
delete swigiterator;
}
}
@@ -282,6 +294,7 @@
%enddef
+%csmethodmodifiers std::map::empty "private"
%csmethodmodifiers std::map::size "private"
%csmethodmodifiers std::map::getitem "private"
%csmethodmodifiers std::map::setitem "private"
@@ -295,18 +308,3 @@ namespace std {
SWIG_STD_MAP_INTERNAL(K, T, C)
};
}
-
-
-// Legacy macros (deprecated)
-%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
-#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
-%enddef
-
-%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
-#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
-%enddef
-
-%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
-#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
-%enddef
-