Templatize AssignNextParameter function implementations

reduce redundant code