1

I'm designing a base class for camera classes. The intent is to use a signal to notify the clients of a newly available image. Cameras may have 8- or 16-bit pixels. I'm trying to templatize them as follows:

#include <boost/signals2.hpp>
#include <boost/cstdint.hpp>

template<typename PX>
class ICamera
{
public:
    typedef PX pixel_type;
    typedef PX const *pFrame;

    typedef boost::signals2::signal<void (ICamera &cam, pFrame buffer)> CaptureSig;
    typedef CaptureSig::slot_type CaptureSlot;   /* error on this line */
    virtual boost::signals2::connection AddCaptureListener(CaptureSlot slot) = 0;
};

In MSVS 2008, when I derive a class from ICamera<uint8_t>, there are compile errors on the typedef on slot_type, firstly: "missing ; before identifier CaptureSlot". That is, the CaptureSig::slot_type is not defined at that point.

Is there a way to get beyond this, other than defining the signal and slot in each derived class?

UPDATE: It's actually not the parameter to the signal that's causing the problem, it's the existence of the signal definition within the template. The same error crops up if the signal's signature is changed to fixed types.

Mike C
  • 1,224
  • 10
  • 26

0 Answers0