8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 18:03:04 +01:00
This commit is contained in:
robocop 2010-01-27 04:33:36 +00:00
parent 57af12867e
commit 2b13bcfa2a

View File

@ -274,7 +274,8 @@ public:
// Resize array according to STL's vector::resize() rules
void resize(const size_t newCount, const T& val)
{
if (newCount > count) {
if (newCount > count)
{
ensureCapacity(newCount);
while (count < newCount) {
data[count++] = val;
@ -358,8 +359,10 @@ public:
// Maybe we should modify it to iterate directy with "pos".
bool find(const T& item, size_t& pos) const
{
for (size_t i = 0; i < count; i++) {
if (data[i] == item) {
for (size_t i = 0; i < count; i++)
{
if (data[i] == item)
{
pos = i;
return true;
}
@ -391,7 +394,8 @@ protected:
void ensureCapacity(size_t newcapacity, bool preserve = true)
{
if (newcapacity > capacity) {
if (newcapacity > capacity)
{
if (newcapacity < capacity * 2) {
newcapacity = capacity * 2;
}
@ -429,7 +433,8 @@ public:
bool find(const Key& item, size_t& pos) const
{
size_t highBound = this->count, lowBound = 0;
while (highBound > lowBound) {
while (highBound > lowBound)
{
const size_t temp = (highBound + lowBound) >> 1;
if (Cmp::greaterThan(item, KeyOfValue::generate(this, this->data[temp])))
lowBound = temp + 1;