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

Reply via email to