c++functionargumentsopenvdb

Function argument has no type


I came across the following code in the OpenVDB documentation:

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())
    {
}

I've seen previously that an argument defaults to an int if no type is specified, but could this be the case here? TopologyCopy is being called as an operator 2 lines below.

What does the above declaration do/mean?

Edit: The accepted answer explains what is happening. The solution is to call the function as

openvdb::Tree newTree(oldTree, inactiveValue, activeValue, TopologyCopy());

Solution

  • It's not an argument without a type. It's an argument without a name. Its type is TopologyCopy. And TopologyCopy() is default constructing an object of that type and passing it to the constructor of mRoot. If I had to guess, I would say they are probably using tag dispatching here to select between different constructors with otherwise identical arguments.