On Thursday, 6 March 2014 at 12:08:35 UTC, Nicolas Sicard wrote:
On Thursday, 6 March 2014 at 11:49:51 UTC, Edwin van Leeuwen
wrote:
On Thursday, 6 March 2014 at 11:28:21 UTC, Mike Parker wrote:
See std.algorithm.move
Thank you, can't believe I missed that. How do I specify that
the function expects a temporary/xvalue (&&) parameter though?
What are you trying to do? D is not C++11. Pure functional
programming in D follows a different path.
I guess what I am trying to do is allow code that looks like this:
v = add_to_vector( x, v );
while enforcing that v is never copied. I know there are other
ways to do this, i.e.
void add_to_vector( x, ref v );
but for me the earlier pattern is more explicit about what is
happening, while still being as efficient.