Replace FOREACH_ENUMERATOR by ranges