Boost logo

Boost Users :

From: Edward Diener (eddielee_at_[hidden])
Date: 2003-08-26 16:47:28


shyamemani wrote:
> When I mentioned the performance cost I was comparing two programming
> techniques. a) Using call back interfaces and b) using
> boost::functions. As Douglas mentioned that if the operator is
> inlined, the performance of boost::function will be better since
> virtual functions cannot be inlined by the compiler and I agree with
> him.

Boost.functions can accept as callbacks member function pointers, global
functions, and function objects.

> But with interfaces I can define multiple functions in it and
> register to recieve multiple events. Use of this in boost::function
> would require calling register multiple times. I think I am
> considering wrong application of the library.

A single Boost::function can call only a single callback.

Use Boost.signals for multiple event handling. A handler can be any of the
above mentioned in my first answer and any number of handlers can attach
themselves to a signal ( an event ).


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