> Hey,
>
[quoted text clipped - 6 lines]
> simillar to delegates. Just wondering if there's anything better out
> there.
If you want something like delegates, boost::function is a good way to go.
-cd
> So far I've found a library called boost.function
> http://www.boost.org/doc/html/function.html which looks easy to use
> simillar to delegates. Just wondering if there's anything better out
> there.
If you're interested about the internals of implementing delegates in
native C++, you may want to take a look at my article at
http://tweakbits.com/articles/events/index.html
No, I'm not saying it's better than boost::function. However, my article
provides an in-depth explanation of how these delegate (closure)
templates work internally. In fact, I provided two independent solutions
for the same problem. When I started implementing it, boost::function
did not exist, or at least was not publically available yet. The best
thing about my implementation is that it is very small. It only uses 2
pointers, and therefore sizeof(event) = 2 * sizeof(void*), which is the
theoretical minimum (an event must store the address of both the member
function and the object as well). I don't know how it compares to
boost::function's memory requirements, but these days it's not that
important anymore.
Boost has a very nice, generally accepted, multi-platform
implementation, with a wide user-base. I encourage you to use that. My
opinion is that if something is implemented in STL or boost, and it
works for me, I could hardly find a reason not to use it.
Tom
Rob Schieber - 22 Oct 2005 00:55 GMT
>> So far I've found a library called boost.function
>> http://www.boost.org/doc/html/function.html which looks easy to use
[quoted text clipped - 4 lines]
> native C++, you may want to take a look at my article at
> http://tweakbits.com/articles/events/index.html
I'll check out that article, as well as boost then thanks for the input
guys.
--
Rob Schieber