This is exactly the type of pointer arithmetics that GCC likes to
miscompile.
Just use offset >= size() (=subtract begin() from both sides).
Change-Id: Ifb13652d7b96bf4c06727d9c965516e95d16ab5c
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
int priority = ev.priority;
if (isEmpty() ||
last().priority >= priority ||
- begin() + insertionOffset >= end()) {
+ insertionOffset >= size()) {
// optimization: we can simply append if the last event in
// the queue has higher or equal priority
append(ev);