Skip to content

Commit

Permalink
Declare local variable 'auto' to avoid type errors for const containers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackerpilot committed Mar 21, 2018
1 parent 1b3885c commit 551d136
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/containers/hashmap.d
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ struct HashMap(K, V, Allocator = Mallocator, alias hashFunction = generateHash!K
alias CET = ContainerElementType!(This, V);

size_t i;
Node* n = find(key, i);
auto n = find(key, i);
if (n is null)
return defaultValue;
return cast(CET) n.value;
Expand All @@ -164,7 +164,7 @@ struct HashMap(K, V, Allocator = Mallocator, alias hashFunction = generateHash!K
alias CET = ContainerElementType!(This, V);

Hash hash = hashFunction(key);
Node* n = find(key, hash);
auto n = find(key, hash);
if (n is null)
return cast(CET*) &insert(key, defaultValue).value;
else
Expand Down Expand Up @@ -201,7 +201,7 @@ struct HashMap(K, V, Allocator = Mallocator, alias hashFunction = generateHash!K
bool remove(K key)
{
size_t i;
Node* n = find(key, i);
auto n = find(key, i);
if (n is null)
return false;
immutable bool removed = buckets[i].remove(Node(n.hash, n.key));
Expand Down

0 comments on commit 551d136

Please sign in to comment.