how about this?

    Iterator it(first);
    for ( ; !subject.parse(it, last, context, attr); ++it)
    {
        if (it == last)
            return false;
    }
    first = it;
    return true;