Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[request] Use delegates for callbacks #10

Closed
GoogleCodeExporter opened this issue Mar 14, 2015 · 6 comments
Closed

[request] Use delegates for callbacks #10

GoogleCodeExporter opened this issue Mar 14, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

While interface objects do work, I suggest using something like <a
href="http://www.codeproject.com/KB/cpp/FastDelegate.aspx">FastDelegate</a>
as it would allow more flexibility when implementing callbacks and reduce
the virtual function call overhead.  Delegates would have the advantage of
allowing free functions, static methods, non-virtual methods, and virtual
methods with arbitrary names so long as they match the function signature.
 Choice is good.  :)

(I use FastDelegate extensively, so I could implement a demonstration
version without too much trouble.)

Original issue reported on code.google.com by kennethdmiller3 on 31 Aug 2009 at 2:50

@GoogleCodeExporter
Copy link
Author

I wasn't sure if HTML would work, and it clearly didn't.  Anyway, the URL is
http://www.codeproject.com/KB/cpp/FastDelegate.aspx

Original comment by kennethdmiller3 on 31 Aug 2009 at 2:52

@GoogleCodeExporter
Copy link
Author

FastDelegate requires non-standard C++ as well as compiler specific 
implementations.
 Too much work for little gain.  boost::function style delegates would work, but
don't provide any performance advantages (only trade offs).

Original comment by j.nick.terry@gmail.com on 31 Aug 2009 at 8:35

@GoogleCodeExporter
Copy link
Author

While FastDelegate is indeed nonstandard, it's widely supported by modern 
compilers.
 There's another one
(http://www.codeproject.com/KB/cpp/ImpossiblyFastCppDelegate.aspx) that's
standards-compliant but less-widely supported (ironically).  There's always a
possibility that the iPhone or Nintendo DS platforms might have issues, but 
their
compilers seem decent enough.  (Ultimately, a delegate is a simple thing: a 
"this"
pointer and a function address.  There's only so many ways to construct a 
virtual
function or a pointer to member...)

Original comment by kennethdmiller3 on 31 Aug 2009 at 9:26

@GoogleCodeExporter
Copy link
Author

I've made use of FastDelegate on the DS in both ARM and THUMB modes (haven't 
tested
it using the home-brew environment though)

Original comment by the.eter...@gmail.com on 2 Sep 2009 at 10:31

@GoogleCodeExporter
Copy link
Author

You can essentially implement your own delegates already.

Original comment by erinca...@gmail.com on 19 Sep 2009 at 8:15

  • Changed state: WontFix

@GoogleCodeExporter
Copy link
Author

True, though it isn't as efficient because it requires a third layer of 
indirection
(virtual function table, virtual function, and target method).  :)

Original comment by kennethdmiller3 on 19 Sep 2009 at 2:15

schmidmt pushed a commit to schmidmt/box2d that referenced this issue Nov 9, 2020
* Build and link Box2D in the build script.

Build and link the Box2D submodule in build.rs, not requiring users to have Box2D installed on their system.
This significantly reduces the effort to use this library on Windows, since it does not have a package manager to install Box2D.
This does require users to have CMake installed, because this is what Box2D uses as its build system.

* Use HTTPS for submodule.

* Allow Box2D to be supplied by the user.

* Bump version and update README.

* Keep Box2D include directory constant, but allow the library to be provided.

* Search for Box2D library in proper way.
Update readme.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant