[C++-sig] member function template question.

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Feb 19 20:49:31 CET 2004


Your example has several layers of complexity. I believe the main trick you
need to know is how to use a cast to tell the compiler what you want. E.g.:

  template <typename FloatType>
  bool
  is_positive_definite(
    vec3<FloatType> const& eigenvalues,
    FloatType const& tolerance);

  def("is_positive_definite",
    (bool(*)(vec3<double> const&, double const&)) is_positive_definite);

This is a bit cumbersome but somehow you have to define which FloatType you
want to use since you are crossing the boundary between compile-time
polymorphism and runtime polymorphism.

If you don't like the casts you can also define thin wrappers. This works for
both "normal" functions and member functions.

I don't know how this is handled by Pyste. Maybe someone else can help?

I am also not an expert on dealing with raw pointers, in particular void* needs
special attention. I think there is something about void* in the FAQ that you
might want to read.

Ralf

--- Hanz Meizer <steam at nurfuerspam.de> wrote:
> Sorry to post so many questions, but I've run into something I couldn't 
> decduce from looking through the documentation. Is it possible to wrap 
> member function templates? Example class:


__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools




More information about the Cplusplus-sig mailing list