为什么我这段二分查找计数老是错误啊
```c++
void search2(const T& e) {
int low = 0;
int high = size - 1;
int p = -1;
int count = 0;
clock_t start_time = clock();
while (low <= high) {
int mid = (low + high) / 2;
if (elem[mid] == e) {
p = mid;
count++;
break;
}
else if (elem[mid] < e) {
low = mid+1;
}
else {
high = mid - 1;
}
}
clock_t end_time = clock();
double time2 = double(end_time - start_time) / CLOCKS_PER_SEC;
if (p >= 0) {
cout << "元素 " << e << " 的最小秩为 " << p << ",数量为 " << count << endl;
}
else {
cout << "无此元素" << endl;
}
cout << "二分查找所需时间:" << time2 << " 秒" << endl;
if (size == capacity) {
expand();
}
}
```