mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
Add asserts to SmallVector so that calls to front() and back() only succeed
if the vector is not empty. This will ensure that calls to these functions will reference elements in the vector. llvm-svn: 173321
This commit is contained in:
parent
c2b44a1250
commit
53fe31003c
@ -145,16 +145,20 @@ public:
|
||||
}
|
||||
|
||||
reference front() {
|
||||
assert(!empty());
|
||||
return begin()[0];
|
||||
}
|
||||
const_reference front() const {
|
||||
assert(!empty());
|
||||
return begin()[0];
|
||||
}
|
||||
|
||||
reference back() {
|
||||
assert(!empty());
|
||||
return end()[-1];
|
||||
}
|
||||
const_reference back() const {
|
||||
assert(!empty());
|
||||
return end()[-1];
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user