aboutsummaryrefslogtreecommitdiff
path: root/Lib/d/std_map.i
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/d/std_map.i')
-rw-r--r--Lib/d/std_map.i4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/d/std_map.i b/Lib/d/std_map.i
index c5e03d06d..a374f55aa 100644
--- a/Lib/d/std_map.i
+++ b/Lib/d/std_map.i
@@ -44,7 +44,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void del(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);