Reed Hedges wrote:
> Peter Amstutz wrote:
> > Try
> >
> >    template<class T> register() {
> >      VobjectBase::registerHandler<T>("message", &T::handler);
> >    }
> >
> > (note T::handler)
>
> Same problem -- it can't use the method in the base class when the
> template parameter is the derived class--
>

Could you use casting to make the compiler happy? Something like:

  template<class T> register() {
    VobjectBase::registerHandler<T>("message", ( void (T::*)(Message*) )
&handler);
  }

... it should be safe to cast a pointer-to-base-class-member down to a
pointer-to-derived-class-member. Maybe a dynamic_cast is necessary instead
(especially in the case of a virtual derived class)? But I'm too lazy to
actually test any of this out right now ;)

-Ken


_______________________________________________
vos-d mailing list
vos-d@interreality.org
http://www.interreality.org/cgi-bin/mailman/listinfo/vos-d

Reply via email to