Loading…
|
Translation uploaded |
|
|
String added in the repository |
|
Flags
safe-html, strict-same
Loading…
|
Translation uploaded |
|
|
String added in the repository |
|
This unusually laid out data structure is chosen to make iteration of the entire container efficient by inter-connecting all of the nodes into a singly-linked list. One might also notice that buckets point to the node _before_ the start of the bucket's elements. This is done so that removing elements from the list can be done efficiently without introducing the need for a doubly-linked list. Unfortunately, this data structure introduces a guaranteed extra indirection. For example, to access the first element of a bucket, something like this must be done:这种非常规数据结构通过将所有节点连成单向链表来实现高效全局迭代。需注意:桶指向其元素起始节点的__前驱节点__,这样设计的目的是在保持高效元素删除的同时,无需引入双向链表。但这种数据结构不可避免地带来了额外的间接访问开销。例如,要访问某个桶的第一个元素,必须执行类似以下操作: