void print1(Args...)(Args args){
print2(args);
}
void print2(Args...)(Args args){
//do something
}
And you can call it like this
print1(1, 2);
But what if there is a non copyable type inside the variadic argument?
struct Foo{
@disable this(this);
~this(){
}
}
then
print(1, 2, Foo());
Error: struct app.Foo is not copyable because it is annotated with @disable
It should be possible with mixins
void print1(Args...)(Args args){
mixin(forward!(print2, Args));
}
which would expand to
// with `print(1, 2, Foo());`
void print1(Args...)(Args args){
mixin("print2(args[0], args[1], args[2].move()");
}
Are there any other alternatives besides this? Does something like this already exist?