d的appendTo包装
struct AppendTo(T)
{
private T[] *arr;
this(return T[]* arr) { this.arr = arr; }
void put(X)(X val) if (__traits(compiles, (*arr) ~= val)) {
(*arr) ~= val;
}
}
auto appendTo(T)(return ref T[] arr)
{
return AppendTo!T(&arr);
}
浙公网安备 33010602011771号