Passing a template class as argument

Hello, I’m developing an openFrameworks addon that will create a generative mesh. I want to let to the end user to decide which geometry will be used while creating this mesh, if a tube, a box or whatever. My initial idea was to use template classes but I’m not sure anymore if this is the right solution.
I write here some pseudocode to try to explain my problem. I’ve a grow method that it is called during the update method of the ofApp.

grow(){
    for (branch in:newBranches) {
        auto box = new Box();
        addNewBranchToMesh(box);
    }
}

what I want to do is to give to the user the ability to pass a class to the grow method. Not an instance of an object, but a class

grow(myGeometry ){
    for (branch in:newBranches) {
        auto box = new myGeometry();
        addNewBranchToMesh(box);
    }
}

In a way that the user could define a myBox class, a myCylinder class or whatever. I’m not referring to of3dPrimitives, but to custom defined classes that come with some basic method, like getMesh, startFrom, endTo.

Does this make sense? is it the proper way to solve this problem in c++?

yes templates sounds like the right solution if you really need to pass any class and instantiate that same class in the function

ok, thanks, i will give a try