Topic: HELP with a template


Author: jsnow@britten.sbi.com (John Snow)
Date: Sun, 1 May 1994 05:51:48 GMT
Raw View
I have a class with a member variable that is a pointer to a member function
of another class.  The form is:

class Class {
    ...
    void* (OtherClass::*func)(void*, void*);
};

I would like to change this class into a template with a form like:

template<class X, class Y, class Z>
class Class {
    ...
    X (OtherClass::*func)(Y, Z);
};

The compiler will accept the template form shown, but I can't find any
was to actually assign a function to the variable.  It won't accept it
directly and I can't find any form of a cast that will work.  Does anyone
have any idea how to make this thing work?  I would really like to put
this template form into a typedef, but that's probable a REAL fantasy.

I am using the Sun cfront compiler on Solaris, but I'vd tried g++ too.
The errors are different, but the results are the same.  Any information
or suggestions will be appreciated.

Thanks



--
+-----------------------------------------------------------------------------+
| John Snow    ::   Application Development   ::   Salomon Bros Inc.   ::     |
| jsnow@schubert.sbi.com  ::  (813) 558-6165  ::  #include <std_disclamer.h>  |
+-----------------------------------------------------------------------------+
| Bigot: One who is obstinately and zealously attached to an opinion that you |
| do not entertain. -- The Devil's Dictionary                                 |
+-----------------------------------------------------------------------------+