maps don't have random access iterators. Hence m_state.begin() + idx can't be used here. advance just repeatedly calls operator++. would save a single line of code with the burden of a function call.