Quick Links: |
Provide utilities operating on iterators and iterator ranges. More...
Namespaces | |
namespace | bslstl |
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)
. int values[] = { 1, 2, 3, 4, 5 }; int *begin = &values[0]; int *end = &values[3];
IteratorUtil::insertDistance
class method to calculate the distance of the open range [begin .. end)
: std::size_t distance = IteratorUtil::insertDistance(begin, end); assert(3 == distance);