Skip to content

Commit

Permalink
-preview=in: Replace 'in ref' with 'const ref'
Browse files Browse the repository at this point in the history
Allow the code to compile with '-preview=in'.
  • Loading branch information
Geod24 authored and dlang-bot committed Sep 2, 2020
1 parent 8cdffc8 commit fc1625a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/containers/hashmap.d
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ struct HashMap(K, V, Allocator = Mallocator, alias hashFunction = generateHash!K
/**
* Support for $(D foreach(key, value; aa) { ... }) syntax;
*/
int opApply(int delegate(in ref K, ref V) del)
int opApply(int delegate(const ref K, ref V) del)
{
int result = 0;
foreach (ref bucket; buckets)
Expand All @@ -318,7 +318,7 @@ struct HashMap(K, V, Allocator = Mallocator, alias hashFunction = generateHash!K
}

/// ditto
int opApply(int delegate(in ref K, in ref V) del) const
int opApply(int delegate(const ref K, const ref V) del) const
{
int result = 0;
foreach (const ref bucket; buckets)
Expand All @@ -340,7 +340,7 @@ struct HashMap(K, V, Allocator = Mallocator, alias hashFunction = generateHash!K
}

/// ditto
int opApply(int delegate(in ref V) del) const
int opApply(int delegate(const ref V) del) const
{
int result = 0;
foreach (const ref bucket; buckets)
Expand Down Expand Up @@ -657,7 +657,7 @@ version(emsi_containers_unittest) unittest
string name;
}

void someFunc(ref in HashMap!(string,Foo) map) @safe
void someFunc(const scope ref HashMap!(string,Foo) map) @safe
{
foreach (kv; map.byKeyValue())
{
Expand Down
3 changes: 1 addition & 2 deletions src/containers/treemap.d
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ version(emsi_containers_unittest) unittest
string name;
}

void someFunc(ref in TreeMap!(string,Foo) map) @safe
void someFunc(const scope ref TreeMap!(string,Foo) map) @safe
{
foreach (kv; map.byKeyValue())
{
Expand Down Expand Up @@ -445,4 +445,3 @@ version(emsi_containers_unittest) unittest
//foreach (k; counts.keys.sort())
//writeln(k, "=>", counts[k]);
}

0 comments on commit fc1625a

Please sign in to comment.