BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstl::IteratorUtil Struct Reference

#include <bslstl_iteratorutil.h>

Static Public Member Functions

template<class InputIterator >
static bsl::iterator_traits< InputIterator >::difference_type insertDistance (InputIterator first, InputIterator last)
 

Detailed Description

This utility struct provides a namespace for functions on iterators and iterator ranges.

Member Function Documentation

◆ insertDistance()

template<class InputIterator >
bsl::iterator_traits< InputIterator >::difference_type bslstl::IteratorUtil::insertDistance ( InputIterator  first,
InputIterator  last 
)
static

Return 0 if the (template parameter) type InputIterator is limited to the standard input-iterator category, otherwise return the number of elements that is reachable from the specified first to (but not including) the specified last. This function has a constant-time complexity if the iterator category of InputIterator is a strictly a standard input iterator, or is a random access iterator, otherwise it is linear in the length of the range [first .. last). The behavior is undefined unless last is reachable from first. Note that this function always returns 0 when compiled with the Sun compiler, while we work around issues in the Sun standard library.

This local class provides a utility to estimate the maximum number of elements that may be inserted by a range-insert operation on a standard container, by performing tag dispatch on the iterator's category type.


The documentation for this struct was generated from the following file: