accumulate_range: better iterative check for return_type param