Defined Terms
abstract data typeA type whose representation is hidden. To use an abstract type, we need know only what operations the type supports.
bitsetStandard library class that holds a collection of bits and provides operations to test and set the bits in the collection.
cctype headerHeader inherited from C that contains routines to test character values. See page 88 for a listing of the most common routines.
class templateA blueprint from which many potential class types can be created. To use a class template, we must specify what actual type(s) or value(s) to use. For example, a vector is a template that holds objects of a given type. When we create a vector, we must say what type this vector will hold. vector<int> holds ints, vector<string> holds strings, and so on.
containerA type whose objects hold a collection of objects of a given type.
difference_typeA signed integral type defined by vector that is capable of holding the distance between any two iterators.
emptyFunction defined by the string and vector types. empty returns a bool indicating whether the string has any characters or whether the vector has any elements. Returns TRue if size is zero; false otherwise.
getlineFunction defined in the string header that takes an istream and a string. The function reads the stream up to the next newline, storing what it read into the string, and returns the istream. The newline is read and discarded.
high-orderBits in a bitset with the largest indices.
indexValue used in the subscript operator to denote the element to retrieve from a string or vector.
iteratorA type that can be used to examine the elements of a container and to navigate between them.
iterator arithmeticThe arithmetic operations that can be applied to some, but not all, iterator types. An integral type can be added to or subtracted from an iterator, resulting in an iterator positioned that many elements ahead of or behind the original iterator. Two iterators can be subtracted, yielding the distance between the iterators. Iterator arithmetic is valid only on iterators that refer to elements in the same container or the off-the-end iterator of the container.
low-orderBits in a bitset with the lowest indices.
off-the-end iteratorThe iterator returned by end. It is an iterator that refers to a nonexistent element one past the end of a container.
push_backFunction defined by vector that appends elements to the back of a vector.
sentinelProgramming technique that uses a value as a guard to control processing. In this chapter, we showed the use of the iterator returned by end as a guard to stop processing elements in a vector once we had processed every element in the vector.
sizeFunction defined by the library types string, vector, and bitset that returns the number of characters, elements, or bits respectively. The string and vector functions return a value of the size_type for the type. For example, size of a string returns a string::size_type. The bitset operation returns a value of type size_t.
size_tMachine-dependent unsigned integral type defined in cstddef header that is large enough to hold the size of the largest possible array.
size_typeType defined by the string and vector classes that is capable of containing the size of any string or vector, respectively. Library classes that define size_type define it as an unsigned type.
using declarationsMake a name from a namespace accessible directly.
makes name accessible without the namespace:: prefix.
using namespace::name;
value initializationInitialization that happens for container elements when the container size is specified but there is no explicit element initializer. The elements are initialized as a copy of a compiler-generated value. If the container holds built-in types, then the value copied into the elements is zero. For class types, the value is generated by running the class's default constructor. Container elements that are of class type can be value-initialized only if the class has a default constructor.
++ operatorThe iterator types define the increment operator to "add one" by moving the iterator to refer to the next element.
:: operatorThe scope operator. It finds the name of its right-hand operand in the scope of its left-hand operand. Used to access names in a namespace, such as std::cout, which represents the name cout from the namespace std. Similarly, used to obtain names from a class, such as string::size_type, which is the size_type defined by the string class.
[] operatorAn overloaded operator defined by the string, vector, and bitset types. It takes two operands: The left-hand operand is the name of the object and the right-hand operand is an index. It fetches the element whose position matches the index. Indices count from zerothe first element is element 0 and the last is element indexed by obj.size() - 1. Subscript returns an lvalue, so we may use a subscript as the left-hand operand of an assignment. Assigning to the result of a subscript assigns a new value to the indexed element.
* operatorThe iterator types define the dereference operator to return the object to which the iterator refers. Dereference returns an lvalue, so we may use a dereference operator as the left-hand operand of an assignment. Assigning to the result of a dereference assigns a new value to the indexed element.
<< operatorThe string and bitset library types define an output operator. The string operator prints the characters in a string. The bitset operator prints the bit pattern in the bitset.
>> operatorThe string and bitset library types define an input operator. The string operator reads whitespace delimited chunks of characters, storing what is read into the right-hand (string) operand. The bitset operator reads a bit sequence into its bitset operand.