mixin 给出错误
示例位于: http://www.d-programming-language.org/mixin.html ,出现如下:
template GenStruct(char[] Name, char[] M1) {
const char[] GenStruct = "struct " ~ Name ~ "{ int " ~ M1 ~ "; }";
} mixin(GenStruct!("Foo", "bar"));
“它生成:”(根据网站):
struct Foo { int bar; }
给我一个错误:
错误:模板实例 GenStruct!(“Foo”,“bar”)GenStruct!(“Foo”, "bar") 与模板声明不匹配GenStruct(char[] Name,char[] M1)
这是我的还是他们的错误?
The example at: http://www.d-programming-language.org/mixin.html, appears below:
template GenStruct(char[] Name, char[] M1) {
const char[] GenStruct = "struct " ~ Name ~ "{ int " ~ M1 ~ "; }";
} mixin(GenStruct!("Foo", "bar"));
"which generates:" (according to the site):
struct Foo { int bar; }
gives me an error:
Error: template instance GenStruct!("Foo","bar") GenStruct!("Foo","bar") does not match template declaration GenStruct(char[] Name,char[] M1)
Is it mine or their bug ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
文字已过时。将
char[]
替换为string
就可以了。The text is outdated. Replace
char[]
withstring
and it'll work.