Boost logo

Boost Users :

Subject: Re: [Boost-users] [Function] Takes functor by value not reference?
From: Jeff Schwab (jeff_at_[hidden])
Date: 2010-02-14 13:00:38


Alexander Lamaison wrote:
> I may be misunderstanding as the boost::function code is tricky to follow
> but it seems to me that the function contructor takes the functor it is
> passed by value rather than by reference.
>
> This requires the functor to be copyable. In my case I'm trying to pass a
> functor as its abstract supertype which prevents copying. Is it not
> possible to take the functor my reference, thereby removing the need for
> copying?

Could you just use a Boost.Ref wrapper? Rather than passing f, you
would pass ref(f).


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