清单的清单?
尝试创建涉及列表的自定义数据类型,并且接受大多数通用类型似乎没问题 我不知道如何制作列表列表,但似乎......
在我的主要程序中,我希望摆脱这样的事情:
type INFO is record
Neighbors:List(ITEM => Unbounded_String);
Name:Unbounded_String;
end record;
package Graph is new List(ITEM => INFO);
为什么这不起作用?
Trying to make a custom data type involving lists, and it seems to be fine accepting most generic types
I don't know how to make a list of lists though, it seems...
In my main procedure I was hoping to get away with something like this:
type INFO is record
Neighbors:List(ITEM => Unbounded_String);
Name:Unbounded_String;
end record;
package Graph is new List(ITEM => INFO);
Why doesn't this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那么,对于您的 Neighbors 字段,您必须指定一个类型。那里的错误语法让人想起通用实例化。
更多类似的内容(警告,未编译):
然后 Graph.List_Type 将是您的信息记录列表。
不过要小心!更新列表项时,您必须清楚地了解按值传递与按引用传递语义。
Well, for your Neighbors field you have to specify a type. The incorrect syntax that's there is reminiscent of a generic instantiation.
Something more along the lines of this (warning, not compiled):
Then Graph.List_Type will be your list of Info records.
Caution, though! You have to keep a clear understanding of pass-by-value vs pass-by-reference semantics when updating list items.