Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template Utilities::pow() #9764

Merged
merged 1 commit into from Mar 29, 2020
Merged

Template Utilities::pow() #9764

merged 1 commit into from Mar 29, 2020

Conversation

peterrum
Copy link
Member

closes #9762

pow(const unsigned int base, const int iexp)
template <typename T>
constexpr T
pow(const T base, const int iexp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment that T must be an integral type (otherwise the initialization 1 might not work) and the case pow <= 0 -> 1 is not true; it would be best if you add static_assert(std::is_integral<T>::value, "Only integral types supported") here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank! Done.

@kronbichler
Copy link
Member

/rebuild

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a templated version of Utilities::pow()
3 participants