mercredi 27 mai 2015

Why does std::binary_search return bool?

According to draft N4431, http://ift.tt/1OwPZmm (and at least one other earlier draft), the function std::binary_search in the algorithms library returns a bool.

Below is a screenshot from N4431: binary_serach screenshot

Does anyone know why this is the case?

Most other generic algorithms either return an iterator to the element or an iterator that is equivalent to the iterator denoting the end of the sequence of elements (i.e., one after the last element to be considered in the sequence), which is what I would have expected.

Aucun commentaire:

Enregistrer un commentaire