@@ -1142,6 +1142,13 @@ struct RootNodeCopyHelper
11421142template <typename RootT, typename OtherRootT>
11431143struct RootNodeCopyHelper <RootT, OtherRootT, /* Compatible=*/ true >
11441144{
1145+ // / @todo Consider using a value conversion functor passed as an argument instead.
1146+ template <typename ValueT, typename OtherValueT>
1147+ static inline ValueT convertValue (const OtherValueT &val)
1148+ {
1149+ return ValueT (val);
1150+ }
1151+
11451152 static inline void copyWithValueConversion (RootT& self, const OtherRootT& other)
11461153 {
11471154 using ValueT = typename RootT::ValueType;
@@ -1152,12 +1159,7 @@ struct RootNodeCopyHelper<RootT, OtherRootT, /*Compatible=*/true>
11521159 using OtherMapCIter = typename OtherRootT::MapCIter;
11531160 using OtherTile = typename OtherRootT::Tile;
11541161
1155- struct Local {
1156- // / @todo Consider using a value conversion functor passed as an argument instead.
1157- static inline ValueT convertValue (const OtherValueT& val) { return ValueT (val); }
1158- };
1159-
1160- self.mBackground = Local::convertValue (other.mBackground );
1162+ self.mBackground = convertValue<ValueT, OtherValueT>(other.mBackground );
11611163#if OPENVDB_ABI_VERSION_NUMBER >= 10
11621164 if (other.mOrigin != Coord (0 ,0 ,0 )) {
11631165 OPENVDB_THROW (ValueError, " RootNodeCopyHelper::copyWithValueConversion: non-zero offsets are currently not supported" );
@@ -1174,7 +1176,7 @@ struct RootNodeCopyHelper<RootT, OtherRootT, /*Compatible=*/true>
11741176 // Copy the other node's tile, but convert its value to this node's ValueType.
11751177 const OtherTile& otherTile = other.getTile (i);
11761178 self.mTable [i->first ] = NodeStruct (
1177- Tile (Local:: convertValue (otherTile.value ), otherTile.active ));
1179+ Tile (convertValue<ValueT, OtherValueT> (otherTile.value ), otherTile.active ));
11781180 } else {
11791181 // Copy the other node's child, but convert its values to this node's ValueType.
11801182 self.mTable [i->first ] = NodeStruct (*(new ChildT (other.getChild (i))));
0 commit comments