int *ptr = std::upper_bound(array, array+len, what); // a custom comparator can be given as fourth arg