mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-06 05:35:47 +01:00
add MidiByteArray::compare_n()
This commit is contained in:
parent
69a789c513
commit
acf586b058
2 changed files with 21 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue