April 29, 2016 [Issue 15662] Cannot move struct with defined opAssign due to @disabled post-blit | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15662 --- Comment #11 from Martin Nowak <code@dawg.eu> --- Here is how you define a properly typed insertBack method. struct Buffer(T) // T can be const/immutable { // value type, requires insertBack(move(val)) for non-copyable types // compiler will perform any implicit conversions void insertBack(T value) { reserve(1); memcpy(ptr + idx, &value, T.sizeof); // clear value, so it's destructor won't double free anything static if (hasElaborateDestructor!T) { static if (!hasElaborateAssign!T && isAssignable!T) chunk = T.init; else { import core.stdc.string : memcpy; static immutable T init = T.init; memcpy(&value, &init, T.sizeof); } } } } -- |
May 13, 2016 [Issue 15662] Cannot move struct with defined opAssign due to @disabled post-blit | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15662 --- Comment #12 from Martin Nowak <code@dawg.eu> --- (In reply to Martin Nowak from comment #11) > static if (!hasElaborateAssign!T && isAssignable!T) > chunk = T.init; That needs to be `value = T.init;`. Direct assignment is an optional optimization over using memcpy. > else > { > import core.stdc.string : memcpy; > static immutable T init = T.init; > memcpy(&value, &init, T.sizeof); > } -- |
December 17, 2022 [Issue 15662] Cannot move struct with defined opAssign due to @disabled post-blit | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15662 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
December 13 [Issue 15662] Cannot move struct with defined opAssign due to @disabled post-blit | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15662 --- Comment #13 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17747 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation