Details
Type modifiers:
static type variable;
For local declarations, declares variable with static storage class. The value of variable persists across executions of this scope and is guaranteed to be initialized before the variable is used for the first time. When the program exits from the scope, the variable keeps its value until the next time the program enters that scope. The meaning of static varies with context.
Types: The built-in type void can be used in a restricted number of ways, one of which is to indicate that a function yields no return value. Such functions can be exited through a return; that has no value or by falling off the end of the function.
Iterator adaptors are functions that yield iterators. The most common are the adaptors that generate insert_iterators, which are iterators that grow the associated container dynamically. Such iterators can be used safely as the destination of a copying algorithm. They are defined in the header <iterator>:
back_inserter(c)Yields an iterator on the container c that appends elements to c. The container must support push_back, which the list, vector, and the string types all do.
front_inserter(c)Like back_inserter, but inserts at the front of the container. The container must support push_front, which list does but string and vector do not.
inserter(c, it)Like back_inserter, but inserts elements before the iterator it.
Algorithms: Unless otherwise indicated, <algorithm> defines these algorithms:
accumulate(b, e, t)Creates a local variable and initializes it to a copy of t (with the same type as t, which means that the type of t is crucially important to the behavior of accumulate), adds each element in the range [b, e) to the variable, and returns a copy of the variable as its result. Defined in <numeric>.
find(b, e, t), find_if(b, e, p), and search(b, e, b2, e2)Algorithms to look for a given value in the sequence [b, e). The find algorithm looks for the value t, the find_if algorithm tests each element against the predicate p, and the search algorithm looks for the sequence denoted by [b2, e2).
copy(b, e, d), remove_copy(b, e, d, t), and remove_copy_if(b, e, d, p)Algorithms to copy the sequence from [b, e) to the destination denoted by d. The copy algorithm copies the entire sequence, remove_copy copies all elements not equal to t, and remove_copy_if copies all elements for which the predicate p fails.
remove_if(b, e, p)Arranges the container so that the elements in the range [b, e) for which the predicate p is false are at the front of the range. Returns an iterator denoting one past the range of these "unremoved" elements.
remove(b, e, t)Like remove_if, but tests which elements to keep against the value t.
transform(b, e, d, f)Runs the function f on the elements in the range [b, e), storing the result of find.
partition(b, e, p) stable_partition(b, e, p)Partitions the elements in the range [b, e), based on the predicate p, so that elements for which the predicate is true are at the front of the container. Returns an iterator to the first element for which the predicate is false, or e if the predicate is true for all elements. The stable_partition function maintains the input order among the elements in each partition.