Team LiB
Previous Section Next Section

Chapter Summary

The library defines several higher-level abstract data types, including strings and vectors. The string class provides variable-length character strings, and the vector type manages a collection of objects of a single type.

C++ 标准库定义了几种更高级的抽象数据类型,包括 string 和 vector 类型。string 类型提供了变长的字符串,而 vector 类型则可用于管理同一类型的对象集合。

Iterators allow indirect access to objects stored in a container. Iterators are used to access and navigate between the elements in strings and vectors.

迭代器实现了对存储于容器中对象的间接访问。迭代器可以用于访问和遍历 string 类型和 vectors 类型的元素。

In the next chapter we'll cover arrays and pointers, which are types built into the language. These types provide low-level analogs to the vector and string libraries. In general, the library classes should be used in preference to low-level array and pointer alternatives built into the language.

下一章将介绍 C++ 的内置数据类型:数组和指针。这两种类型提供了类似于 vector 和 string 标准库类型的低级抽象类型。总的来说,相对于 C++ 内置数据类型的数组和指针而言,程序员应优先使用标准库类类型。

    Team LiB
    Previous Section Next Section