Showing with 15 additions and 4 deletions.
  1. +2 −2 src/object.di
  2. +13 −2 src/object_.d
4 changes: 2 additions & 2 deletions src/object.di
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,8 @@ auto byKeyValue(T : Value[Key], Value, Key)(T aa) pure nothrow @nogc @property
private Key* keyp;
private Value* valp;

@property ref Key key() { return *keyp; }
@property ref Value value() { return *valp; }
@property ref inout(Key) key() inout { return *keyp; }
@property ref inout(Value) value() inout { return *valp; }
}
return Pair(cast(Key*)_aaRangeFrontKey(r),
cast(Value*)_aaRangeFrontValue(r));
Expand Down
15 changes: 13 additions & 2 deletions src/object_.d
Original file line number Diff line number Diff line change
Expand Up @@ -2142,8 +2142,8 @@ auto byKeyValue(T : Value[Key], Value, Key)(T aa) pure nothrow @nogc @property
private Key* keyp;
private Value* valp;

@property ref Key key() { return *keyp; }
@property ref Value value() { return *valp; }
@property ref inout(Key) key() inout { return *keyp; }
@property ref inout(Value) value() inout { return *valp; }
}
return Pair(cast(Key*)_aaRangeFrontKey(r),
cast(Value*)_aaRangeFrontValue(r));
Expand Down Expand Up @@ -2419,6 +2419,17 @@ unittest
assert(count == aa.length);
}

unittest
{
// Verify iteration with const.
auto aa = [1:2, 3:4];
foreach (const t; aa.byKeyValue)
{
auto k = t.key;
auto v = t.value;
}
}

// Explicitly undocumented. It will be removed in March 2015.
deprecated("Please use destroy instead of clear.")
alias destroy clear;
Expand Down