Static array initialization... with const pointers... to overloaded, templatized member functions. Is there a way it can be done (C++03 standard code)? I mean, if I have the template class
template <class T1, class U1, typename R1> class Some_class { public: typedef T1 T; typedef U1 U; typedef R1 R; R operator()(T& v) { /* dereference pointer to a derived class (U), overloaded member function (U::f) */ }; private: static R (U::* const pmfi[/* # of overloaded functions in U */])(T&); }; Used as template <class BASE, typename RET> class Other_class : public Some_class<BASE, Other_class<BASE, RET>, RET> { RET f(/* type derived from BASE */) {} RET f(/* other type derived from BASE */) {} RET f(/* another type derived from BASE */) {} ... }; Question: how can I initialize de array pmfi (no typedefs, please)?
Notes:
1. As a static array MUST be initialized at file scope, template parameters and pmfi must be full qualified (the only way I know to access template parameters outside a class scope is to typedef them...).
2. So far so good. No problems with the compiler (Comeau 4.3.10.1). Problems start popping up when I try to fullfill the initializer list { ... }.
2.1. The compiler complains the template argument list is missing, no matter what I do.
2.2. I have no idea how to select the correct overloaded U::f function.
BTW, this is a kind of "jump table" generator from a boost.preprocessor list. The code I am trying to implement is of course much more complex then this one, but this is his essence.
Thanks for any help