Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-03-27 13:10:34


Darin Adler wrote:
>
> Daryle Walker wrote:
> >> I think I changed it because I heard that compilers inline function objects
> >> better than functions.
>
> on 3/27/01 9:45 AM, Jens Maurer at Jens.Maurer_at_[hidden] wrote:
> > This sounds like a very platform-dependent claim which is hopefully
> > backed by lots of benchmarks on different platforms? In other words:
> > This is most certainly not correct in general.
>
> Although this is platform-dependent, it's not really just one programmer's
> opinion. For example, Bjarne mentions this in section 18.4 of The C++
> Programming Language. To quote him (page 515 of the Special Edition): "For
> example, it is easier to inline the application operator of a class than to
> inline a function passed as a pointer to a function. Consequently, function
> objects often execute faster than do ordinary functions."

I didn't get the impression from the code that you're passing around
function (object) pointers. Instead, I read "reflector_type()( x )",
where reflector_type is a "typedef reflect<>". This surely looks
like, in effect, a normal function call to me.

You may want to check whether explicit value template parameters
for functions is broken on MSVC before changing that, though.

Jens Maurer


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk