-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
ENH: Refine Tensor and Add CopyFrom #3056
Conversation
class PODDeleter { | ||
static_assert(std::is_pod<T>::value, "T must be POD"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why shall we use static_assert
instead of template parameter? Any benefit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- SFINAE is a versatile and powerful but potentially complicated.
static_assert
makes more verbatim and hence clearer code.static_assert
has the benefit of a clearer compiler error message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that in this case, where we don't have other templates for PODDeleter, static_assert is the right choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
class PODDeleter { | ||
static_assert(std::is_pod<T>::value, "T must be POD"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that in this case, where we don't have other templates for PODDeleter, static_assert is the right choice.
Add both CPU and GPU CopyFrom Unit Test