>> trouble. Also, the alternative is usually function pointers which have >> atleast 50 times the overhead of a function object. Correct me if I'm >> wrong. >> > function objects really cannot be 50 times more efficient as function > pointer are rather efficient with very little overhead.
With well-designed code, function objects ("functors") should be compiled inline, and have zero overhead. Function pointers are never inlined (unless modern compilers are getting *really* clever), so they always have some overhead. Functors are therefore divide-by-zero-times more efficient (I don't know where Nick got the 50 times figure from :-). (If the functor is large enough to not be inlined then it is execution time that dominates and function call overhead is not important.) Using functors might cause more code, so less code fits in cache. I don't know how that affects overall performance. Darren _______________________________________________ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/