[#BloombergLP-bslstl-IteratorUtil-insertDistance] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/IteratorUtil.adoc[IteratorUtil]::insertDistance :relfileprefix: ../../../ :mrdocs: Return the number of elements to account for when range‐inserting. == Synopsis Declared in `<bslstl_iteratorutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class t_INPUT_ITERATOR, class t_SENTINEL> static bsl::iterator_traits<t_INPUT_ITERATOR>::difference_type insertDistance( t_INPUT_ITERATOR const& first, t_SENTINEL const& last); ---- == Description Return 0 if the (template parameter) type `t_INPUT_ITERATOR` is limited to the standard input‐iterator category, otherwise return the number of elements reachable from the specified `first` to (but not including) the specified `last`. This function has a constant‐time complexity if the iterator category of `t_INPUT_ITERATOR` is 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`. == Return Value the number of elements in `[first .. last)]`, or 0 if distance cannot be calculated for the iterator category == Parameters [cols="1,4"] |=== | Name| Description | *first* | beginning of the half‐open range | *last* | end of the half‐open range |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#