函数参数没有类型
Function argument has no type
我在 OpenVDB 文档中看到了以下代码:
template<typename _RootNodeType>
class Tree: public TreeBase
{
...
template<typename OtherTreeType>
Tree(const OtherTreeType& other,
const ValueType& inactiveValue,
const ValueType& activeValue,
TopologyCopy): // <-- this looks weird
TreeBase(other),
mRoot(other.root(), inactiveValue, activeValue, TopologyCopy())
{
}
我之前看到如果没有指定类型,参数 defaults to an int
,但这里会是这种情况吗? TopologyCopy
在下面 2 行中作为运算符被调用。
上面的声明是什么do/mean?
编辑:
接受的答案解释了正在发生的事情。解决方案是将函数调用为
openvdb::Tree newTree(oldTree, inactiveValue, activeValue, TopologyCopy());
TopologyCopy
是一种类型,由于未使用 argument/variable,因此不存在。
跟随TopologyCopy()
构造一个TopologyCopy
.
这不是没有类型的参数。这是一个没有名字的论点。它的类型是TopologyCopy
。而 TopologyCopy()
是默认构造一个该类型的对象并将其传递给 mRoot
的构造函数。如果非要我猜的话,我会说他们可能在这里使用标签分派 select 在不同的构造函数之间使用相同的参数。
我在 OpenVDB 文档中看到了以下代码:
template<typename _RootNodeType>
class Tree: public TreeBase
{
...
template<typename OtherTreeType>
Tree(const OtherTreeType& other,
const ValueType& inactiveValue,
const ValueType& activeValue,
TopologyCopy): // <-- this looks weird
TreeBase(other),
mRoot(other.root(), inactiveValue, activeValue, TopologyCopy())
{
}
我之前看到如果没有指定类型,参数 defaults to an int
,但这里会是这种情况吗? TopologyCopy
在下面 2 行中作为运算符被调用。
上面的声明是什么do/mean?
编辑: 接受的答案解释了正在发生的事情。解决方案是将函数调用为
openvdb::Tree newTree(oldTree, inactiveValue, activeValue, TopologyCopy());
TopologyCopy
是一种类型,由于未使用 argument/variable,因此不存在。
跟随TopologyCopy()
构造一个TopologyCopy
.
这不是没有类型的参数。这是一个没有名字的论点。它的类型是TopologyCopy
。而 TopologyCopy()
是默认构造一个该类型的对象并将其传递给 mRoot
的构造函数。如果非要我猜的话,我会说他们可能在这里使用标签分派 select 在不同的构造函数之间使用相同的参数。