[signals] signals::slot_type not working?

Hi, below is my code:
template< InputSubscription t_sub >
static void subscribe( SignalBank const& bank, typename
GetSignal

Robert Dailey wrote:
template< InputSubscription t_sub > static void subscribe( SignalBank const& bank, typename GetSignal
::signal::slot_type& slot ) { using boost::fusion::at_c; at_c ( bank.signals ).connect( slot ); } void footest() { subscribe
( bank, &mouseCB ); }; Notice that I have a wrapper function, 'subscribe', which uses the slot_type member of the signals class to pass the slot to the connect() function.
Try making that 'const ...::slot_type&' instead?

On Feb 6, 2008 1:56 PM, Nat Goodspeed
Try making that 'const ...::slot_type&' instead?
I tried that too, but the error gets even more crazy:
*1>c:\it\personal\rocket_test\source\inputtest.cpp(48) : error C2663:
'boost::signal2

Hmm, I think I found the issue. My signal object is const for some reason.
I'm doing a lot of tricks to map enums to signal objects, I'll post all the
code at the bottom of this message. My fusion::vector either must be
containing the signal objects as const, or fusion::at_c must be returning
const. I'm not really sure.
namespace detail
{
template< InputSubscription t_sub >
struct sub
{
const static InputSubscription value = t_sub;
};
using boost::mpl::map;
using boost::mpl::pair;
typedef map<
pair< sub
::type signal; };
struct SignalBank
{
boost::fusion::vector<
GetSignal

Oh god, how embarrassing. My 'subscribe()' function was passing in the SignalBank object as a const reference! Doh! Problem solved.
participants (2)
-
Nat Goodspeed
-
Robert Dailey