templated teh pow function so that any type can be used