On Monday 10 February 2003 07:19 am, Markus Werle wrote:
Before I dig in that code: where do those copies come from? Is that the normal behaviour triggered ny operator() or is that a hint that I use them the wrong way?
operator() will not make any copies. The overhead of operator() comes from calls through function pointers. The most likely reason I can think of for the multitude of copy constructions after the array is built is that you are passing boost::function2 objects to routines that take function objects by value. Unfortunately, this is the common way to pass function objects, e.g., template<typename F> void do_something(F f) { ... } If you are using the C++ standard library algorithms, that may be your culprit. You can pass a "reference" to those algorithms by changing 'f' parameters to: boost::bind(ref(f), _1, _2) Doug