What's wrong with this code?
Chris via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Sep 19 10:35:04 PDT 2015
Update:
If I add *also* a auto vec2 = vec; now the code works. So it
looks like this now:
voxel_vec [string] move_buttons = [
"button_xp" : voxel_vec ([ 1, 0, 0 ]),
"button_xm" : voxel_vec ([ -1, 0, 0 ]),
"button_yp" : voxel_vec ([ 0, 1, 0 ]),
"button_ym" : voxel_vec ([ 0, -1, 0 ]),
"button_zp" : voxel_vec ([ 0, 0, 1 ]),
"button_zm" : voxel_vec ([ 0, 0, -1 ]) ];
foreach (bname, vec; move_buttons) {
Button bmove = cast (Button) g.getObject (bname);
bmove.addOnClicked (delegate void (Button aux) {
auto glw2 = glw;
auto vec2 = vec;
if (!glw2.sel_active) return;
glw2.vf.move (3, vec2, glw2.sel_limits);
glw2.set_mesh (glw2.vf.polygonize);
} );
}
and works as expected. I'm going to leave it like that in the
belief it's a compiler bug, if someone wants to take a look at
the full source I'm willing to disclose it.
Thanks again for the help and the idea of the work around.
More information about the Digitalmars-d-learn
mailing list