Is the following code legal?
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Wed Nov 2 07:52:33 PDT 2016
On 11/02/2016 10:21 AM, Shachar Shemesh wrote:
> int[int] hash;
>
> ..
>
> foreach( key, ref value; hash ) {
> if( value>12 )
> hash.remove(key);
> }
>
> Some hash implementations support this, some don't. The D documentation
> (https://dlang.org/spec/hash-map.html) leaves this not defined.
>
> As reference, C++ does define this (in C++ it is allowed, at least since
> C++14: http://en.cppreference.com/w/cpp/container/unordered_map/erase)
>
> Shachar
We should render it defined, and document it as such. Could you please
create an issue and I'll have someone look at it. Thanks! -- Andrei
More information about the Digitalmars-d
mailing list