BDE 4.14.0 Production release
|
Provide utilities operating on iterators and iterator ranges.
This component provides a namespace, bslstl::IteratorUtil
, containing utility functions for iterator types. In particular, this component includes a function insertDistance
that returns the number of elements that should be accounted for when range-inserting in a container, given a pair of iterator a
and b
describing a half-open range [a .. b)
.
This section illustrates intended use of this component.
Suppose we want to find the number of elements between two random access iterators.
First, we create an array of integer values and two pointers (which are considered random access iterators) referring to the beginning and end of a range within that array:
Now, we use the IteratorUtil::insertDistance
class method to calculate the distance of the open range [begin .. end)
: