diff --git a/wrap/Class.cpp b/wrap/Class.cpp index 06dbdb898..21e2a56d2 100644 --- a/wrap/Class.cpp +++ b/wrap/Class.cpp @@ -759,8 +759,6 @@ void Class::emit_cython_pxd(FileWriter& pxdFile, const std::vector& allCl methods_.size() + templateMethods_.size(); if (numMethods == 0) pxdFile.oss << "\t\tpass"; - - pxdFile.oss << "\n\n"; } /* ************************************************************************* */ diff --git a/wrap/Constructor.cpp b/wrap/Constructor.cpp index 545bc406a..9e56b7d39 100644 --- a/wrap/Constructor.cpp +++ b/wrap/Constructor.cpp @@ -141,12 +141,9 @@ void Constructor::emit_cython_pxd(FileWriter& pxdFile, Str className) const { ArgumentList args = argumentList(i); // ignore copy constructor, it's generated above by default if (args.size() == 1 && args[0].is_const && args[0].is_ref && - !args[0].is_ptr) { - cout << args[0].type.cythonClass() << " vs " << className << endl; - if (args[0].type.cythonClass() == className || - args[0].type.cythonClass() == "This") + !args[0].is_ptr && (args[0].type.cythonClass() == className || + args[0].type.cythonClass() == "This")) continue; - } // generate the constructor pxdFile.oss << "\t\t" << className << "("; diff --git a/wrap/Module.cpp b/wrap/Module.cpp index c4894c8ce..4f0dcd98c 100644 --- a/wrap/Module.cpp +++ b/wrap/Module.cpp @@ -344,21 +344,25 @@ void Module::emit_cython_pxd(FileWriter& pxdFile) const { types.emit_cython_pxd(pxdFile); //... wrap all classes - for(const Class& cls: uninstantiatedClasses) - cls.emit_cython_pxd(pxdFile, uninstantiatedClasses); - - //... ctypedef for template instantiations - // TODO: put them in the correct place!!! - for(const Class& cls: expandedClasses) { - if (cls.templateClass) { - pxdFile.oss << "ctypedef " << cls.templateClass->cythonClass() << "["; - for (size_t i = 0; iname_ != cls.name_) + continue; + pxdFile.oss << "ctypedef " << expCls.templateClass->cythonClass() + << "["; + for (size_t i = 0; i < expCls.templateInstTypeList.size(); ++i) + pxdFile.oss << expCls.templateInstTypeList[i].cythonClass() + << ((i == expCls.templateInstTypeList.size() - 1) + ? "" + : ", "); + pxdFile.oss << "] " << expCls.cythonClass() << "\n"; + } + pxdFile.oss << "\n\n"; } - pxdFile.oss << "\n"; pxdFile.emit(true); }