Secondary Ordering to MidiBuffer

Is there a secondary ordering to the MidiBuffer, in the case of multiple events happening at the same timestamp? I was hoping for it to be by the note number, as that would be nicely predictable. If not, is there a way to sort it using the note number if the timestamps are equal?

Looking at this code (from JUCE/juce_MidiBuffer.cpp at e6ec1819ec0a59a7cfe82d8ce72367f64e0a4bb0 · juce-framework/JUCE · GitHub):

bool MidiBuffer::addEvent (const void* newData, int maxBytes, int sampleNumber)
{
...


    auto offset = (int) (MidiBufferHelpers::findEventAfter (data.begin(), data.end(), sampleNumber) - data.begin());


    data.insertMultiple (offset, 0, (int) newItemSize);


    auto* d = data.begin() + offset;
    writeUnaligned<int32>  (d, sampleNumber);
    d += sizeof (int32);
    writeUnaligned<uint16> (d, static_cast<uint16> (numBytes));
    d += sizeof (uint16);
    memcpy (d, newData, (size_t) numBytes);


    return true;
}

It appears that if the timestamps are equal, the message added last appears first, and it’s up to the host to choose which message shows up first if they’re equal, so this could present some inconsistencies.

I wonder, is there a simple and efficient way to make sure the MidiBuffer has a secondary ordering of note number?