作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
是否可以在 Chapel 记录中为泛型类型声明 LinkedList 字段?
我想我想做的是:
record LIST {
var itm: LinkedList(?t);
};
?t
声明记录时未知,但是:
./Structs.chpl:87: internal error: RES-CAL-NFO-0078 chpl version 1.19.0
Note: This source location is a guess.
Internal errors indicate a bug in the Chapel compiler ("It's us, not you"),
and we're sorry for the hassle. We would appreciate your reporting this bug --
please see https://chapel-lang.org/bugs.html for instructions. In the meantime,
the filename + line number above may be useful in working around the issue.
最佳答案
为此,您可以制作 LIST
类型泛型。
record LIST {
type T;
var itm: LinkedList(T);
}
var lst: LIST(int);
writeln(lst.type:string);
writeln(lst.itm.type:string);
LIST(int(64))
LinkedList(int(64))
lst
所有字段的具体类型必须在声明时知道
lst
.我们制造
LIST
在类型上记录泛型
T
,然后使用此类型信息实例化字段
itm
.
关于chapel - 是否可以在记录中为泛型类型声明 LinkedList 字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57680270/
我是一名优秀的程序员,十分优秀!