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:
parent
b289487583
commit
8856edf4a7
|
@ -91,8 +91,8 @@ class Deque {
|
||||||
/// Return a reference to an item at the given virtual index in range [0; mSize-1]
|
/// Return a reference to an item at the given virtual index in range [0; mSize-1]
|
||||||
T& getItem(uint64 virtualIndex) const {
|
T& getItem(uint64 virtualIndex) const {
|
||||||
|
|
||||||
// If the virtual index is valid
|
// Ensure the virtual index is valid
|
||||||
if (virtualIndex < mSize) {
|
assert(virtualIndex < mSize);
|
||||||
|
|
||||||
uint64 chunkIndex = mFirstChunkIndex;
|
uint64 chunkIndex = mFirstChunkIndex;
|
||||||
uint64 itemIndex = mFirstItemIndex;
|
uint64 itemIndex = mFirstItemIndex;
|
||||||
|
@ -112,10 +112,6 @@ class Deque {
|
||||||
|
|
||||||
return mChunks[chunkIndex][itemIndex];
|
return mChunks[chunkIndex][itemIndex];
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Add more chunks
|
/// Add more chunks
|
||||||
void expandChunks(uint64 atLeastNbChunks = 0) {
|
void expandChunks(uint64 atLeastNbChunks = 0) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user