Conversation
|
Sorry, but I'm against this pull. Though In my pull #923 I did my best for CTFE so it will work in CT if there is no elaborate stuff and In the future, I plant to tweak my Note, that my |
|
And yes, thanks for showing the issue my pull fixes (I mean Issue 8349) |
Well if you talking about elaborate destructors and such then yes it doesn't do a move. My reasoning was that aside of specific tests copy vs move is a question of performance and extra copies/destroys. And since we are in CTFE it doesn't matter that much. Of course if CTFE had ability to cast pointers and reinterpret data as binary chunks I'd do full move. Either way you may just pick unittest from my pull..
Cool to see you catch this idea. I'm curious how you would make it CTFE friendly though. |
|
This may cause things like double destruction (of members inside the objects involved); I'm not sure to what extent that's a problem during compilation, but it does look a source of subtle differences between compile-time and run-time behavior. |
|
I'm OK with better options but I fail to see a move being done in CTFE as 'move' as it doesn't allow bitblits like that. |
As I already wrote above, my (recently rejected) |
|
The problem is no in being able to destroy object. It is an ability to do a bitblit over typed data. I claim that it is impossible in CTFE as it stands unless reinterpret casts are defined in CTFE (they are not). |
|
As always I may be wrong so wait some time and I will either implement |
|
Closing as outdated, unsafe and not giving equvivalent semantics at CTFE. |
|
To @blackwhale:
I hope unstd.array.rawCopy will make you happy in this new year! |
Woha! The tupleof trick! This stuff is surely impressive. |
Finally found a way to make acceptable version of move for CTFE.
Curently I opted to just do a copy. The implementation involves jumping through some hoops to ensure that RVO/NRVO is still applied for the run-time conterpart. See also:
http://d.puremagic.com/issues/show_bug.cgi?id=8991
As a side affect it fixes http://d.puremagic.com/issues/show_bug.cgi?id=8349 and maybe others.