@@ -54,9 +54,9 @@ struct TreeMap(K, V, Allocator = Mallocator, alias less = "a < b",
5454 /**
5555 * Inserts or overwrites the given key-value pair.
5656 */
57- void insert (const K key, V value) @safe
57+ void insert (const K key, V value) @trusted
5858 {
59- auto tme = TreeMapElement(key, value);
59+ auto tme = TreeMapElement(cast (ContainerStorageType ! K) key, value);
6060 auto r = tree.equalRange(tme);
6161 if (r.empty)
6262 tree.insert(tme, true );
@@ -78,7 +78,7 @@ struct TreeMap(K, V, Allocator = Mallocator, alias less = "a < b",
7878 auto opIndex (this This)(const K key) inout
7979 {
8080 alias CET = ContainerElementType! (This, V);
81- auto tme = TreeMapElement(key);
81+ auto tme = TreeMapElement(cast (ContainerStorageType ! K) key);
8282 return cast (CET ) tree.equalRange(tme).front.value;
8383 }
8484
@@ -126,16 +126,16 @@ struct TreeMap(K, V, Allocator = Mallocator, alias less = "a < b",
126126 */
127127 bool remove (const K key)
128128 {
129- auto tme = TreeMapElement(key);
129+ auto tme = TreeMapElement(cast (ContainerStorageType ! K) key);
130130 return tree.remove(tme);
131131 }
132132
133133 /**
134134 * Returns: true if the mapping contains the given key
135135 */
136- bool containsKey (const K key) inout pure nothrow @nogc @safe
136+ bool containsKey (const K key) inout pure nothrow @nogc @trusted
137137 {
138- auto tme = TreeMapElement(key);
138+ auto tme = TreeMapElement(cast (ContainerStorageType ! K) key);
139139 return tree.contains(tme);
140140 }
141141
0 commit comments