Correct reference and pointer type for generator