reorder statements in Deque getFront and getBack, so that both functions return on every control path

Signed-off-by: DNKpp <DNKpp2011@gmail.com>
This commit is contained in:
DNKpp 2020-08-25 23:11:07 +02:00
parent 0bda62ad5b
commit a209b89e59

View File

@ -495,18 +495,14 @@ class Deque {
/// Return a reference to the first item of the deque
const T& getFront() const {
if (mSize > 0) {
return mChunks[mFirstChunkIndex][mFirstItemIndex];
}
assert(false);
assert(mSize > 0);
return mChunks[mFirstChunkIndex][mFirstItemIndex];
}
/// Return a reference to the last item of the deque
const T& getBack() const {
if (mSize > 0) {
return mChunks[mLastChunkIndex][mLastItemIndex];
}
assert(false);
assert(mSize > 0);
return mChunks[mLastChunkIndex][mLastItemIndex];
}
/// Clear the elements of the deque