我得到一个错误
Error: template std.array.Appender!(string).Appender.put does not match any
function template declaration 我正在尝试使用Appender。你能告诉我怎么使它工作吗?
import std.array;
import std.stdio;
void app(inout Appender!(string) as)
{
char ch = 'o';
as.put(ch);
}
void main()
{
auto app2 = appender!string();
//writeln(typeid(app));
app2.put('g');
app(app2);
}发布于 2013-01-06 01:56:04
将inout更改为ref。
inout用于将cont/immutable/none属性从函数实参传递到其参数。ref用于通过引用传递函数参数。
https://stackoverflow.com/questions/14174270
复制相似问题