diff options
Diffstat (limited to 'libs/surfaces/push2/midi_byte_array.cc')
-rw-r--r-- | libs/surfaces/push2/midi_byte_array.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/surfaces/push2/midi_byte_array.cc b/libs/surfaces/push2/midi_byte_array.cc index 45d0439a75..e66cd7d287 100644 --- a/libs/surfaces/push2/midi_byte_array.cc +++ b/libs/surfaces/push2/midi_byte_array.cc @@ -94,3 +94,22 @@ MidiByteArray & operator << (MidiByteArray & mba, const std::string & st) mba.insert (mba.end(), st.begin(), st.end()); return mba; } + +bool +MidiByteArray::compare_n (const MidiByteArray& other, MidiByteArray::size_type n) const +{ + MidiByteArray::const_iterator us = begin(); + MidiByteArray::const_iterator them = other.begin(); + + while (n && us != end() && them != other.end()) { + if ((*us) != (*them)) { + return false; + } + --n; + ++us; + ++them; + } + + return true; +} + |