Boost logo

Boost Users :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-04-25 18:24:13


On Fri, Apr 25, 2008 at 5:19 PM, Steven Watanabe <watanabesj_at_[hidden]>
wrote:

> AMDG
>
> Robert Dailey wrote:
> >
> >
> >
> > You can construct a boost::function at the call site explicitly
> rather
> > than relying on the implicit conversion.
> >
> > Alternately you can provide an overload of Subscribe for function
> > pointers.
> >
> >
> > That kind of defeats the purpose. I'm trying to make Subscribe figure
> > out the type of the packet itself to avoid having to explicitly say
> > "I'm subscribing for a WalkPacket" when the signature of the slot
> > already has this information. The current implementation requires this
> > syntax:
> >
> > Subscribe<WalkPacket>( &walkPacketCallback );
>
> If you only need to deal with function pointers,
>
> template<class T>
> void Subscribe(void (*callback)(const packet_t&)) {
> Subscribe(boost::function<void(const packet_t&)>(callback));
> }
>

What about for function objects?



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