P
PGP
Anybody here using __event? Could you please discuss any potential issues
with it other than portability?
Priyesh
with it other than portability?
Priyesh
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
PGP said:Anybody here using __event? Could you please discuss any potential issues
with it other than portability?
I was wondering about the native C++ part of it. Would you rather look intoBen Voigt said:Nope. People using C++ in the managed world are now using C++/CLI (new in
VC++ 2005) which no longer supports the __event keyword, instead using
"context-sensitive" keywords that are only recognized at certain
locations.
PGP said:I was wondering about the native C++ part of it. Would you rather look
into
a third party library or would you consider using the __event, __hook
and __unhook? Overall, I did not find any good feedback on the __event
mechanism during my research, but I would defenitely want to use it
if it's here to stay. I have done some tests of my own and tried out
MSDN samples. It does exactly what I want it to do. Now I am
looking for some reassurance.
[...]Are you looking for COM compatibility? If you just want event
handling in within a C++ application, then pointer-to-member-function is
100% in the C++ standard and does what you want. In the rare case you
need to support multiple subscribers, then a std::vector or std::list of
pointer-to-member-function will get you there, again 100% standard and
portable.
Ben,Ben Voigt said:You were in the C++/CLI newsgroup... microsoft.public.vc.language is
focused on native features.
Are you looking for COM compatibility? If you just want event handling in
within a C++ application, then pointer-to-member-function is 100% in the
C++ standard and does what you want. In the rare case you need to support
multiple subscribers, then a std::vector or std::list of
pointer-to-member-function will get you there, again 100% standard and
portable. A template helper function can hide the details of iterating
through and calling all receivers. That will get even better in C++0x
with template support for arbitrary argument lists (not sure what the
correct name of the feature is).
Boris said:[...]Are you looking for COM compatibility? If you just want event
handling in within a C++ application, then pointer-to-member-function is
100% in the C++ standard and does what you want. In the rare case you
need to support multiple subscribers, then a std::vector or std::list of
pointer-to-member-function will get you there, again 100% standard and
portable.
Or have a look at Boost.Signals (see
http://www.boost.org/doc/html/signals.html) which is C++
standard-compatible library which should do what you want out of the box.
Boris
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.