返回介绍

附录D 链表

发布于 2020-09-09 22:56:13 字数 2631 浏览 972 评论 0 收藏 0

The List package implements a classic list data-structure, and is analogous to the STL (Standard Template Library) List container that is popular with C++ programmers. The container is defined as a parameterized class, meaning that it can be customized to hold data of any type.

主题
主题描述
D.1 List definitionslist—A list is a doubly linked list, where every element has a predecessor and successor. A list is a sequence that supports both forward and backward traversal, as well as amortized constant time insertion and removal of elements at the beginning, end, or middle.

container—A container is a collection of data of the same type. Containers are objects that contain and manage other data. Containers provide an associated iterator that allows access to the contained data.

iterator—Iterators are objects that represent positions of elements in a container. They play a role similar to that of an array subscript, and allow... more
D.2 List declarationThe List package supports lists of any arbitrary predefined type, such as integer, string, or class object.

Any iterator that refers to the position of an element that is removed from a list becomes invalid, thus, unable to iterate over the list.

To declare a specific list, users must first include the generic List class declaration from the standard include area and then declare the specialized list type:
‘include <List.vh>
...
List#(type) dl; // dl is a List of 'type' elements
D.3 Linked list class prototypesThe following class prototypes describe the generic List and List_Iterator classes. Only the public interface is included here.
D.4 List_Iterator methodsThe List_Iterator class provides methods to iterate over the elements of lists. These methods are described below.
D.5 List methodsThe List class provides methods to query the size of the list, obtain iterators to the head or tail of the list,retrieve the data stored in the list, and methods to add, remove, and reorder the elements of the list.
链接 主题

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文