Am 15.01.2014 21:54, schrieb anonymous:
If you want to stop after the first match:

auto f = entries.find!(d => d.key == 3);
if(f.empty) entries ~= Data(3,42);
else f.front.value = 42;

If there can be duplicates and you want to change them all:

auto f = entries.filter!(d => d.key == 3);
if(f.empty) entries ~= Data(3,42);
else foreach(ref e; f) e.value = 42;

Fantastic!
Thanks a lot.

Kind regards
André

Reply via email to