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

[BUG] component-wise math ops break for non-POD types #1970

Open
hiokazaki opened this issue Nov 18, 2024 · 0 comments
Open

[BUG] component-wise math ops break for non-POD types #1970

hiokazaki opened this issue Nov 18, 2024 · 0 comments
Labels

Comments

@hiokazaki
Copy link

hiokazaki commented Nov 18, 2024

Describe the bug

The functions cwiseAdd, cwiseLessThan and cwiseGreaterThan in openvdb/math/Math.h should only be enabled for POD types, but are not guarded, so they break when grids with non-POD types are used.

A simple fix is something like:

template<typename Type1, typename Type2,
  typename = std::enable_if_t<
    std::is_trivial<Type1>::value && std::is_trivial<Type2>::value
  >
>
inline bool cwiseGreaterThan(const Type1& a, const Type2& b)

This should result in no functional change for OpenVDB as shipped, but permit third parties to extend support for custom non-POD types.

@hiokazaki hiokazaki added the bug label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant