[#BloombergLP-bslstl-IteratorUtil_LegacyInsertDistance-03]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::IteratorUtil&lowbar;LegacyInsertDistance
:relfileprefix: ../../
:mrdocs:

Utility for type&hyphen;based dispatch of insert&hyphen;distance calculation&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;iteratorutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class t&lowbar;INPUT&lowbar;ITERATOR,
    class t&lowbar;SENTINEL,
    bool t&lowbar;MATCHING&lowbar;SENTINEL = bsl&colon;&colon;is&lowbar;convertible&lt;t&lowbar;SENTINEL, t&lowbar;INPUT&lowbar;ITERATOR&gt;&colon;&colon;value&gt;
struct IteratorUtil&lowbar;LegacyInsertDistance;
----

== Description

This supporting utility type is used for type&hyphen;based dispatch as part of the implementation of the similarly structured functions `insertDistance` and `canCalculateInsertDistance` from `IteratorUtil`&period; Selection between the primary template and secondary (much simpler) one is performed based on the defaulted third parameter that checks if the (template parameter) type `t&lowbar;SENTINEL` is convertible to the (template parameter) type `t&lowbar;INPUT&lowbar;ITERATOR`&period; When the primary template is selected, the decision to delegate distance calculation to `bsl&colon;&colon;distance` is performed using tag dispatch&period;

== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/IteratorUtil_LegacyInsertDistance-03/canCalculate.adoc[`canCalculate`] 
| Return whether insert&hyphen;distance can be calculated for these types&period;
| xref:BloombergLP/bslstl/IteratorUtil_LegacyInsertDistance-03/insertDistance.adoc[`insertDistance`] 
| Return the insertable element count for the specified iterator range&period;
|===


== Specializations

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/IteratorUtil_LegacyInsertDistance-0c.adoc[`IteratorUtil&lowbar;LegacyInsertDistance&lt;t&lowbar;INPUT&lowbar;ITERATOR, t&lowbar;SENTINEL, false&gt;`] 
| Partial specialization that does not support insert&hyphen;distance calculation&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
