Skip to content

Commit

Permalink
changed convert function to template to avoid undefined alias with cl…
Browse files Browse the repository at this point in the history
…ang-cl. Resolves #1785

Signed-off-by: Benjamin Gottheil <[email protected]>
  • Loading branch information
bgottamd committed Apr 4, 2024
1 parent 45d2ce4 commit 5125d79
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions openvdb/openvdb/tree/RootNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,13 @@ struct RootNodeCopyHelper
template<typename RootT, typename OtherRootT>
struct RootNodeCopyHelper<RootT, OtherRootT, /*Compatible=*/true>
{
/// @todo Consider using a value conversion functor passed as an argument instead.
template<typename ValueT, typename OtherValueT>
static inline ValueT convertValue(const OtherValueT &val)
{
return ValueT(val);
}

static inline void copyWithValueConversion(RootT& self, const OtherRootT& other)
{
using ValueT = typename RootT::ValueType;
Expand All @@ -1152,12 +1159,7 @@ struct RootNodeCopyHelper<RootT, OtherRootT, /*Compatible=*/true>
using OtherMapCIter = typename OtherRootT::MapCIter;
using OtherTile = typename OtherRootT::Tile;

struct Local {
/// @todo Consider using a value conversion functor passed as an argument instead.
static inline ValueT convertValue(const OtherValueT& val) { return ValueT(val); }
};

self.mBackground = Local::convertValue(other.mBackground);
self.mBackground = convertValue<ValueT, OtherValueT>(other.mBackground);
#if OPENVDB_ABI_VERSION_NUMBER >= 10
if (other.mOrigin != Coord(0,0,0)) {
OPENVDB_THROW(ValueError, "RootNodeCopyHelper::copyWithValueConversion: non-zero offsets are currently not supported");
Expand All @@ -1174,7 +1176,7 @@ struct RootNodeCopyHelper<RootT, OtherRootT, /*Compatible=*/true>
// Copy the other node's tile, but convert its value to this node's ValueType.
const OtherTile& otherTile = other.getTile(i);
self.mTable[i->first] = NodeStruct(
Tile(Local::convertValue(otherTile.value), otherTile.active));
Tile(convertValue<ValueT, OtherValueT>(otherTile.value), otherTile.active));
} else {
// Copy the other node's child, but convert its values to this node's ValueType.
self.mTable[i->first] = NodeStruct(*(new ChildT(other.getChild(i))));
Expand Down

0 comments on commit 5125d79

Please sign in to comment.