Boost logo

Boost Users :

Subject: [Boost-users] Connecting signals where one is a member
From: Chris Stankevitz (chrisstankevitz_at_[hidden])
Date: 2013-11-01 13:04:35


Hello,

"Connect 4" fails to compile in the code below on g++ 4.6.3.

Why does "Connect 4" not work while "Connect 2" does work? Connect 4
and 2 are the same thing as far as I can see.

Thank you,

Chris

#include <boost/signals2/signal.hpp>

typedef boost::signals2::signal<void( )> TDSignalA;
typedef boost::signals2::signal<void(int)> TDSignalB;

TDSignalA SignalA1;
TDSignalB SignalB1;

struct TSItem
{
  TDSignalA SignalA2;
  TDSignalB SignalB2;
};

int main()
{
  TSItem Item;

  // Connect 1
  SignalA1.connect(Item.SignalA2);

  // Connect 2
  SignalA1.connect(TDSignalA::slot_type(&TSItem::SignalA2, &Item));

  // Connect 3
  SignalB1.connect(Item.SignalB2);

  // Connect 4
  //SignalB1.connect(TDSignalB::slot_type(&TSItem::SignalB2, &Item, _1));

  return 0;
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net