Index: operations.hpp =================================================================== --- operations.hpp (revision 70689) +++ operations.hpp (working copy) @@ -686,7 +686,7 @@ else { m_stack.push(directory_iterator(m_stack.top()->path(), *ec)); - if (*ec) return; + if (*ec) {++m_level; return;} } if (m_stack.top() != directory_iterator()) { @@ -768,6 +768,8 @@ { BOOST_ASSERT(m_imp.get() && "increment() on end recursive_directory_iterator"); m_imp->increment(&ec); + if (m_imp->m_stack.empty()) + m_imp.reset(); // done, so make end iterator return *this; }