move an argument tuple

Shachar Shemesh shachar at weka.io
Thu Dec 7 08:19:25 UTC 2017


Hi everybody,

I'm trying to have a templated function like so:

     void func(alias F)(Parameters!F args) {

At some point in func, I want to call F with args:
    F(args);

This does not work if one of args is a struct with copying disabled. 
That's fine. What I'd like to do is to move it into F:
    F( move(args) );

Except that only works if args.length==1. If args.length==2, it thinks 
I'm calling the move overload that moves from the first argument to the 
second, and then it complains that F cannot be called with void argument.

Things that also don't work:
   F( moveAll(args) );
That one accepts two ranges and expects to copy between them.

I guess I can put up a mixin that expands to:
   F( move(args[0]), move(args[1]) );

I'd really like a cleaner solution if one is possible.

Thanks,
Shachar


More information about the Digitalmars-d mailing list