SmallVectorImpl(const SmallVectorImpl&) = delete;
public:
typedef typename SuperClass::iterator iterator;
+ typedef typename SuperClass::const_iterator const_iterator;
typedef typename SuperClass::size_type size_type;
protected:
append(IL);
}
- iterator erase(iterator I) {
+ iterator erase(const_iterator CI) {
+ // Just cast away constness because this is a non-const member function.
+ iterator I = const_cast<iterator>(CI);
+
assert(I >= this->begin() && "Iterator to erase is out of bounds.");
assert(I < this->end() && "Erasing at past-the-end iterator.");
return(N);
}
- iterator erase(iterator S, iterator E) {
+ iterator erase(const_iterator CS, const_iterator CE) {
+ // Just cast away constness because this is a non-const member function.
+ iterator S = const_cast<iterator>(CS);
+ iterator E = const_cast<iterator>(CE);
+
assert(S >= this->begin() && "Range to erase is out of bounds.");
assert(S <= E && "Trying to erase invalid range.");
assert(E <= this->end() && "Trying to erase past the end.");
SCOPED_TRACE("EraseTest");
this->makeSequence(this->theVector, 1, 3);
- this->theVector.erase(this->theVector.begin());
+ const auto &theConstVector = this->theVector;
+ this->theVector.erase(theConstVector.begin());
this->assertValuesInOrder(this->theVector, 2u, 2, 3);
}
SCOPED_TRACE("EraseRangeTest");
this->makeSequence(this->theVector, 1, 3);
- this->theVector.erase(this->theVector.begin(), this->theVector.begin() + 2);
+ const auto &theConstVector = this->theVector;
+ this->theVector.erase(theConstVector.begin(), theConstVector.begin() + 2);
this->assertValuesInOrder(this->theVector, 1u, 3);
}