1
void print1(Args...)(Args args){
print2(args);
}
void print2(Args...)(Args args){
//do something
}
を含む可変長引数を転送および可変長引数内の非コピー可能タイプがある場合は、このは非コピー可能なタイプ
print1(1, 2);
しかし、何のようにそれを呼び出すことができますか?
struct Foo{
@disable this(this);
~this(){
}
}
その後、
print(1, 2, Foo());
Error: struct app.Foo is not copyable because it is annotated with @disable
それは
// with `print(1, 2, Foo());`
void print1(Args...)(Args args){
mixin("print2(args[0], args[1], args[2].move()");
}
に拡大するミックスイン
void print1(Args...)(Args args){
mixin(forward!(print2, Args));
}
で可能でなければなりませんこれ以外の選択肢はありますか?このようなものはすでに存在しますか?