cpp/algorithm/ranges/ends with

Checks whether the second range matches the suffix of the first range.

@1@ Let and  be  and  respectively. If, returns. Otherwise, returns if only if every element in the range  is equal to the corresponding element in. Comparison is done by applying the binary predicate to elements in two ranges projected by  and  respectively.

@2@ Same as, but uses and  as the source ranges, as if using  as ,  as ,  as , and  as.

Return value
if the second range matches the suffix of the first range, otherwise.

Complexity
Generally linear: at most applications of the predicate and both projections. The predicate and both projections are not applied if.

If both and  can be calculated in constant time (i.e. both iterator-sentinel type pairs model, or both range types model ) and , the time complexity is constant.