mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +08:00
added sanity checks in ConditionalIterator
This commit is contained in:
@@ -191,6 +191,12 @@ namespace BlackMisc
|
||||
bool operator >=(const ConditionalIterator &other) const { return m_iterator >= other.m_iterator; }
|
||||
//! @}
|
||||
|
||||
//! \private
|
||||
void checkEnd(const ConditionalIterator &other) // debugging
|
||||
{
|
||||
Q_ASSERT(m_end == other.m_end && m_end == other.m_iterator);
|
||||
}
|
||||
|
||||
private:
|
||||
I m_iterator;
|
||||
I m_end;
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace BlackMisc
|
||||
//! @}
|
||||
|
||||
//! Constructor.
|
||||
CRange(I begin, I end) : m_begin(begin), m_end(end) {}
|
||||
CRange(I begin, I end) : m_begin(begin), m_end(end) { check(begin, end); }
|
||||
|
||||
//! Begin and end iterators.
|
||||
//! @{
|
||||
@@ -168,6 +168,12 @@ namespace BlackMisc
|
||||
private:
|
||||
I m_begin;
|
||||
I m_end;
|
||||
|
||||
void check(...) {};
|
||||
template <class I2, class F> void check(Iterators::ConditionalIterator<I2, F> begin, Iterators::ConditionalIterator<I2, F> end)
|
||||
{
|
||||
begin.checkEnd(end);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user