From 19aac685ab476c00091d2ce67c4e03c52222706d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Sun, 26 Apr 2020 11:49:06 +0200 Subject: [PATCH] HashMap move workaround. Allows using HashMap with key types that don't compile with move() (TaggedUnion in particular). --- utils/vibe/utils/hashmap.d | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/vibe/utils/hashmap.d b/utils/vibe/utils/hashmap.d index de4f83473d..5a5d060385 100644 --- a/utils/vibe/utils/hashmap.d +++ b/utils/vibe/utils/hashmap.d @@ -97,7 +97,9 @@ struct HashMap(TKey, TValue, Traits = DefaultHashMapTraits!TKey, Allocator = IAl { import std.algorithm.mutation : move; this.key = cast(UnConst!Key)key; - this.value = value.move; + static if (is(typeof(value.move))) + this.value = value.move; + else this.value = value; } } private { @@ -161,7 +163,9 @@ struct HashMap(TKey, TValue, Traits = DefaultHashMapTraits!TKey, Allocator = IAl } r = Traits.hashOf(m_table[i].key) & (m_table.length-1); } while ((j