abstract_function: support any integral type