views:

28

answers:

1

I use boost::signal with different function signatures and different combiners. In a class that looks like the one beyond I want to get the return of a certain signal declaration.

template<typename signal_type> class MyClass
{

    signal_type mSignal;

    signal_type::result_type getResult() { return mSignal(); }

}

But signal_type::result_type does not work. So is there a way to get the return type?

+2  A: 

You need typename to use dependent types:

typename signal_type::result_type getResult() { return mSignal(); }

Dependent names (i.e. dependent on a template parameter) are assumed to

  • not name types unless prefixed with typename and to
  • not name templates unless immediately prefixed with template.
Georg Fritzsche
See http://pages.cs.wisc.edu/~driscoll/typename.html for in-depth goodness.
Cogwheel - Matthew Orlando
Thank you, exactly what I was looking for.
rallex