Hoist assert in Deque<T>::getItem

Compiler warns about `control reaches end of non-void function` due to no return statement in the else block. Directly asserting the condition should accomplish the same thing while suppressing the warning.
This commit is contained in:
Mahdi Rakhshandehroo 2022-06-14 15:24:14 -07:00 committed by GitHub
parent b289487583
commit 8856edf4a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,8 +91,8 @@ class Deque {
/// Return a reference to an item at the given virtual index in range [0; mSize-1]
T& getItem(uint64 virtualIndex) const {
// If the virtual index is valid
if (virtualIndex < mSize) {
// Ensure the virtual index is valid
assert(virtualIndex < mSize);
uint64 chunkIndex = mFirstChunkIndex;
uint64 itemIndex = mFirstItemIndex;
@ -112,10 +112,6 @@ class Deque {
return mChunks[chunkIndex][itemIndex];
}
else {
assert(false);
}
}
/// Add more chunks
void expandChunks(uint64 atLeastNbChunks = 0) {