473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

VC++ Delegate Options

Hey,

I need to utilize function pointers in my MFC application. I was
wondering what the best approach is. Im a C# developer, so I'm farily
comofortable using delegates.

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.

--
Rob Schieber
Nov 17 '05 #1
3 1208
"Rob Schieber" <sc******@hotmail.com> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
Hey,

I need to utilize function pointers in my MFC application. I was
wondering what the best approach is. Im a C# developer, so I'm farily
comofortable using delegates.

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 want something like delegates, boost::function is a good way to go.

-cd
Nov 17 '05 #2
Rob Schieber wrote:
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
Nov 17 '05 #3
Tamas Demjen wrote:
Rob Schieber wrote:
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


I'll check out that article, as well as boost then thanks for the input
guys.

--
Rob Schieber
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: PDQBach | last post by:
Hello, im a visual c++ und borland c++builder newbie. i have witten a simple mandelbrot algorithm and compiled it with both vc++ (mfc) and cbuilder (vcl) (same code besides the drawing part)....
15
by: Ramaraj M Bijur | last post by:
Hi All, Could anyone help me to resolve following problem in C the IDE used is Microsoft VC++, Please let me know the which option in VC++ will do the needful The problem statement:...
5
by: Vinod Kushwaha | last post by:
Hi, I am not able to find Source Control Options in the Tools->Options Dialog. Why is it missing ? Is it hidden ? I have only bought VC++ .Net Standard 2003 Edition. Thanks, Vinod Kushwaha
2
by: Chris | last post by:
Hi, Still having problems with converting my VC 2003 project to VC 2005 beta, this time with events (using the new C++ syntax). My class defines the following event: event...
4
by: Alex | last post by:
Hi there I'm switching from VC++ 6.0 to VC++ .NET 2003. Since there is no stand-alone version of VC++ .NET 2003 Pro, I went and purchased the Standard version, which does not have an...
0
by: Yadnesh | last post by:
I have a C++ Legacy code application that I had compiled on VC 6.0 and deployed to customer. The application created crash dump using MiniDumpWriteDump() when unhandled exception occurs. For...
1
by: John | last post by:
I have a VB6 ActiveX dll and it's called from a VC++ app. How can I debug the dll through the app? Please help. Thanks.
1
by: Mayur | last post by:
Hello all, Can any one have the source of How to add event handler in unmanaged MFC application for event source which is in Managed(c# class library). Here is the Event Source code :...
5
by: Filippo Bettinaglio | last post by:
I have a DLL written in C++ (unmanaged), which I want to inteface with. I created a standard window form program with VC++ 2005, all fine I have imported an .h file the .lib file and all works. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.