Topic: typedef templates?


Author: bard@cutter.ssd.loral.com (James Woodyatt)
Date: Mon, 16 Mar 1992 23:10:21 GMT
Raw View
Maybe this is a heretical idea, but how come I can't do this?:

//--- A `typedef template' for member functions.
template<class T> typedef void (T::*MemberFunction)();

//--- A definition of a variable of the above type
MemberFunction<Foo> m = &Foo::bar(); // Assuming Foo has been defined.

I realize that `typedef templates' aren't part of the language -- I
just wish they were. Is the consensus among the C++ gods that `typedef
templates' would be a wart upon the face of the language and would
therefore be undesirable? Why?

Oh sure, I know I could hack together a class template that
approximates what I want, but it just seems more sensible to have a
`typedef template'.

I'm still in the larval stage with C++, so all this might be a really
stupid question for all I know, but, believe me, I have applications
for `typedef templates' other than the toy above. Am I dreaming?

--
James Woodyatt  Space Systems/Loral   Palo Alto, CA   bard@cutter.ssd.loral.com

I am the ultimate *SINK* of truth
Bow and tremble before me, abject plebeians