iterator wrapper for grouping ideals by k, and main uses stl instead of custom map and fold