~SmallVectorImpl() {
// Destroy the constructed elements in the vector.
- destroy_range(this->begin(), this->end());
+ this->destroy_range(this->begin(), this->end());
// If this wasn't grown from the inline copy, deallocate the old space.
if (!this->isSmall())
void clear() {
- destroy_range(this->begin(), this->end());
+ this->destroy_range(this->begin(), this->end());
this->EndX = this->BeginX;
}
void resize(unsigned N, const T &NV) {
if (N < this->size()) {
- destroy_range(this->begin()+N, this->end());
- setEnd(this->begin()+N);
+ this->destroy_range(this->begin()+N, this->end());
+ this->setEnd(this->begin()+N);
} else if (N > this->size()) {
if (this->capacity() < N)
this->grow(N);
construct_range(this->end(), this->begin()+N, NV);
- setEnd(this->begin()+N);
+ this->setEnd(this->begin()+N);
}
}
}
void pop_back() {
- setEnd(this->end()-1);
+ this->setEnd(this->end()-1);
this->end()->~T();
}
// TODO: NEED To compile time dispatch on whether in_iter is a random access
// iterator to use the fast uninitialized_copy.
std::uninitialized_copy(in_start, in_end, this->end());
- setEnd(this->end() + NumInputs);
+ this->setEnd(this->end() + NumInputs);
}
/// append - Add the specified range to the end of the SmallVector.
// Copy the new elements over.
std::uninitialized_fill_n(this->end(), NumInputs, Elt);
- setEnd(this->end() + NumInputs);
+ this->setEnd(this->end() + NumInputs);
}
void assign(unsigned NumElts, const T &Elt) {
clear();
if (this->capacity() < NumElts)
this->grow(NumElts);
- setEnd(this->begin()+NumElts);
+ this->setEnd(this->begin()+NumElts);
construct_range(this->begin(), this->end(), Elt);
}
// Shift all elts down.
iterator I = std::copy(E, this->end(), S);
// Drop the last elts.
- destroy_range(I, this->end());
- setEnd(I);
+ this->destroy_range(I, this->end());
+ this->setEnd(I);
return(N);
}
// Copy over the elements that we're about to overwrite.
T *OldEnd = this->end();
- setEnd(this->end() + NumToInsert);
+ this->setEnd(this->end() + NumToInsert);
size_t NumOverwritten = OldEnd-I;
- uninitialized_copy(I, OldEnd, this->end()-NumOverwritten);
+ this->uninitialized_copy(I, OldEnd, this->end()-NumOverwritten);
// Replace the overwritten part.
std::fill_n(I, NumOverwritten, Elt);
/// which will only be overwritten.
void set_size(unsigned N) {
assert(N <= this->capacity());
- setEnd(this->begin() + N);
+ this->setEnd(this->begin() + N);
}
private:
// Copy over the extra elts.
if (this->size() > RHS.size()) {
size_t EltDiff = this->size() - RHS.size();
- uninitialized_copy(this->begin()+NumShared, this->end(), RHS.end());
+ this->uninitialized_copy(this->begin()+NumShared, this->end(), RHS.end());
RHS.setEnd(RHS.end()+EltDiff);
- destroy_range(this->begin()+NumShared, this->end());
- setEnd(this->begin()+NumShared);
+ this->destroy_range(this->begin()+NumShared, this->end());
+ this->setEnd(this->begin()+NumShared);
} else if (RHS.size() > this->size()) {
size_t EltDiff = RHS.size() - this->size();
- uninitialized_copy(RHS.begin()+NumShared, RHS.end(), this->end());
- setEnd(this->end() + EltDiff);
- destroy_range(RHS.begin()+NumShared, RHS.end());
+ this->uninitialized_copy(RHS.begin()+NumShared, RHS.end(), this->end());
+ this->setEnd(this->end() + EltDiff);
+ this->destroy_range(RHS.begin()+NumShared, RHS.end());
RHS.setEnd(RHS.begin()+NumShared);
}
}
NewEnd = this->begin();
// Destroy excess elements.
- destroy_range(NewEnd, this->end());
+ this->destroy_range(NewEnd, this->end());
// Trim.
- setEnd(NewEnd);
+ this->setEnd(NewEnd);
return *this;
}
// This allows us to avoid copying them during the grow.
if (this->capacity() < RHSSize) {
// Destroy current elements.
- destroy_range(this->begin(), this->end());
- setEnd(this->begin());
+ this->destroy_range(this->begin(), this->end());
+ this->setEnd(this->begin());
CurSize = 0;
this->grow(RHSSize);
} else if (CurSize) {
}
// Copy construct the new elements in place.
- uninitialized_copy(RHS.begin()+CurSize, RHS.end(), this->begin()+CurSize);
+ this->uninitialized_copy(RHS.begin()+CurSize, RHS.end(),
+ this->begin()+CurSize);
// Set end.
- setEnd(this->begin()+RHSSize);
+ this->setEnd(this->begin()+RHSSize);
return *this;
}