[C++-sig] Template Functions
Nicolas Tessore
wz_ at gmx.net
Sun Oct 22 16:36:47 CEST 2006
Hello, I got along fairly well with Py++ and my project.
My build chain worked out quite nice, first I generate a header file
that has the typedef-s, sizeof()-s and template function calls:
/* long list of #includes */
/* This namespace is not going to be exported */
namespace NoExport {
/* Auxiliary function for template export */
inline void export_obj_templates() {
Niflib::NiObjectRef CastObj;
/* Object NiVisController */
sizeof(Niflib::Ref<Niflib::NiVisController>);
Niflib::DynamicCast<Niflib::NiVisController>(CastObj);
Niflib::StaticCast <Niflib::NiVisController>(CastObj);
/* more objects ... */
}
}
(This is one random example object, the CastObj is one generic ancestor
that is cast into all the children classes.)
Now this behaves as expected. I then use a code generator script that
catches all the Ref<T> and DynamicCast<T> and StaticCast<T> and renames
them to:
NiVisControllerRef
DynamicCastToNiVisController()
StaticCastToNiVisController()
Now the problem is: From my perception, pyplusplus should know what type
the template T should be of. At least for the Refs (ok, they are
classes) it does. Still the resulting .def looks like this (NVC =
NiVisController):
bp::def(
"DynamicCastToNVC"
, DynamicCastToNVC_function_type( &::Niflib::DynamicCast )
, ( bp::arg("object") ) );
This is of course an error, it should be:
DynamicCastToNVC_function_type( &::Niflib::DynamicCast<NVC> )
---
Long story short: Why does Py++ not recognize that my functions contain
templates, and does not put it to the right place?
Thanks,
N.
More information about the Cplusplus-sig
mailing list