BloombergLP::bslstl::IteratorUtil_LegacyInsertDistance

Utility for type-based dispatch of insert-distance calculation.

Synopsis

Declared in <bslstl_iteratorutil.h>

template<
    class t_INPUT_ITERATOR,
    class t_SENTINEL,
    bool t_MATCHING_SENTINEL = bsl::is_convertible<t_SENTINEL, t_INPUT_ITERATOR>::value>
struct IteratorUtil_LegacyInsertDistance;

Description

This supporting utility type is used for type-based dispatch as part of the implementation of the similarly structured functions insertDistance and canCalculateInsertDistance from IteratorUtil. 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_SENTINEL is convertible to the (template parameter) type t_INPUT_ITERATOR. When the primary template is selected, the decision to delegate distance calculation to bsl::distance is performed using tag dispatch.

Static Member Functions

NameDescription
canCalculate Return whether insert-distance can be calculated for these types.
insertDistance Return the insertable element count for the specified iterator range.

Specializations

NameDescription
IteratorUtil_LegacyInsertDistance<t_INPUT_ITERATOR, t_SENTINEL, false> Partial specialization that does not support insert-distance calculation.