with external iterator