add MidiByteArray::compare_n()
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ public:
|
||||
|
||||
MidiByteArray( size_t count, MIDI::byte array[] );
|
||||
|
||||
bool compare_n (const MidiByteArray& other, MidiByteArray::size_type len) const;
|
||||
|
||||
/**
|
||||
Accepts a preceding count, and then a list of bytes
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user