How do I write the C++ counterpart for creating a dofmap, which in Python is done by:
dm = V.dofmap()
It's the exact same call, i.e., once you have a FunctionSpace defined in your c++ code, you simply retrieve the dofmap via
std::shared_ptr<const GenericDofMap> dofmap = V.dofmap();