[computer-go] Effective Go Library v0.101
Jason House
jason.james.house at gmail.com
Thu Feb 15 18:10:20 PST 2007
Heikki Levanto wrote:
> To get down to earth, I would like to look at the board at the end of
> each playout, calculate something more than just win/loss, and pass that
> info back to who ever called playout. One way to do that would be to
> pass a function pointer and a (void?) pointer to playout, and have it
> call back the function with the board, winner, and the void pointer. If
> that sounds more like C than C++, it is because I am a C programmer. If
> some other C++ idiom could do the same thing, all the better.
>
If you're going for more of a C++ library feel, function objects are the
way to go. Function objects impose extra overhead but add a potential
for a more generic adapter around other code that uses it. I have yet
to convince myself of the benefit of C++ function objects for most
applications. C++'s support for them is just too clunky in comparison
to other C++ language features (or equivalent ones in other languages
with built-in support).
More information about the computer-go
mailing list