Re: Variadic function parameters passed by move

2017-01-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 21, 2016 23:18:29 Nordlöw via Digitalmars-d-learn wrote: > Do you have any clue on how to most easily find detect whether a > SymbolExpression is the last reference to that symbol in the > scope of the symbol definition, Jonathan? Sorry, but my knowledge of dmd's internals

Re: Variadic function parameters passed by move

2016-12-21 Thread Ali Çehreli via Digitalmars-d-learn
On 12/21/2016 02:59 PM, Nordlöw wrote: On Wednesday, 21 December 2016 at 21:02:17 UTC, Ali Çehreli wrote: void f(Rs...)(Rs ranges) { import std.functional: forward; g(forward!ranges); Interesting. How does this differ from std.algorithm.mutation.move() when R.length is 1? Why do we ha

Re: Variadic function parameters passed by move

2016-12-21 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 23:11:02 UTC, Nordlöw wrote: Given that ref isn't involved, assuming that nothing else after the call to g references ranges, the compiler should move the values in ranges when it calls g Yes, DMD should automatically convert the last reference of a value exp

Re: Variadic function parameters passed by move

2016-12-21 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 21:09:41 UTC, Jonathan M Davis wrote: Given that ref isn't involved, assuming that nothing else after the call to g references ranges, the compiler should move the values in ranges when it calls g, so I would have hoped that the compiler would then allow you to

Re: Variadic function parameters passed by move

2016-12-21 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 21:02:17 UTC, Ali Çehreli wrote: void f(Rs...)(Rs ranges) { import std.functional: forward; g(forward!ranges); Interesting. How does this differ from std.algorithm.mutation.move() when R.length is 1? Why do we have both `move` and `forward`, then?

Re: Variadic function parameters passed by move

2016-12-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 21, 2016 20:27:47 Nordlöw via Digitalmars-d-learn wrote: > If I have a variadic function > > f(Rs...)(Rs ranges) > { > g(ranges); > } > > that calls > > g(Rs...)(Rs ranges) > { > // use ranges > } > > and all or some of the elements in `ranges` are non-copyable can

Re: Variadic function parameters passed by move

2016-12-21 Thread Ali Çehreli via Digitalmars-d-learn
On 12/21/2016 12:27 PM, Nordlöw wrote: If I have a variadic function f(Rs...)(Rs ranges) { g(ranges); } that calls g(Rs...)(Rs ranges) { // use ranges } and all or some of the elements in `ranges` are non-copyable can I somehow move them at the call of `g` inside of `f`. I've tried

Variadic function parameters passed by move

2016-12-21 Thread Nordlöw via Digitalmars-d-learn
If I have a variadic function f(Rs...)(Rs ranges) { g(ranges); } that calls g(Rs...)(Rs ranges) { // use ranges } and all or some of the elements in `ranges` are non-copyable can I somehow move them at the call of `g` inside of `f`. I've tried f(Rs...)(Rs ranges) { import std.a