<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Ryan Joseph <<a href="mailto:genericptr@gmail.com">genericptr@gmail.com</a>> schrieb am So., 16. Juni 2019, 15:29:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I just came across an efficiency issue when using management operators that I’d like to fix before the next release and we have backwards compatibility problems.<br>
<br>
Basically the problem is that the Copy operator doesn’t know if the source value is actually mapped to memory or just a temporary value so we’re forced to always copy memory (just to be safe) even when a simple move would be good enough. C++ has a similar idea of rvalues and lvalues and a copy and move constructor which addresses this.<br>
<br>
Here’s a little example of the problem. What I propose is that we either add a 3rd boolean parameter to the Copy operator or add a new Move operator which is preferred over the Copy operator if it exists (this is much more work obviously but maybe has some benefit). <br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">If we do this at all we should use a separate operator as those two are rather different operations and the compiler would already have figured out which of the two operations is needed and thus the code inside the operator doesn't need to do that anymore. </div><div dir="auto"><br></div><div dir="auto">That said this would require extending the RTL assignment helper. </div><div dir="auto"><br></div><div dir="auto">And the problems that Jonas mentioned are less problems inside the compiler, but problems inside the user code when they write their Move operator incorrectly. From great power comes great responsibility after all and I'm not sure whether we should provide the users with that much power. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>