You might need a const overload, `int opApply(int delegate(ref const E) dg) const`.