Boost logo

Boost Users :

Subject: Re: [Boost-users] [signals2] tracking intrusively ref-counted object
From: Frank Mori Hess (fmhess_at_[hidden])
Date: 2009-09-06 10:31:30


On Sunday 06 September 2009, Igor R wrote:
> >> struct object
> >> {
> >>   void init()
> >>   {
> >>     selfAncor_ = some_intrusive_ptr<object>(this);
> >>     connection1_ = signal1_.connect(&handle, ref(selfAncor_));
> >>     connection2_ = signal2_.connect(&handle, ref(selfAncor_));
> >
> > No, you want to bind a copy of the smart pointer to the slot by value.
> > Making the slot accept it by reference just avoids creating another
> > temporary copy during invocation
>
> Excuse my ignorance, how can I make "the slot accept it by reference"
> if I bind "a copy of the smart pointer to the slot by value"?

I mean something like:

some_intrusive_ptr<object> selfAncor_;
void handle(const some_intrusive_ptr<object> &this); // accept by reference
signal1_.connect(&handle, selfAncor_); // bind value




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