GitHub - kaidokert/cpp-delegate: A short version of Elbert Mai's lightweight delegates/callbacks in C++11 | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

kaidokert/cpp-delegate

Repository files navigation

Delegate

Travis Status Appveyor Status Coverage Status

Elbert Mai's generic callback/delegate, C++11 with no other dependencies except <utility>. No exceptions/rtti/heap usage, and just about 100 lines of single header template code.

This is effectively a raw function pointer wrapped in a typesafe template and has no runtime code size or processing overhead with any of the compilers.

Implementation patterned after version from this smart function pointer article and https://github.com/reiver-dev/cppcallback

Use primarily through CREATE_DELEGATE macro:

struct foo {
	bool bar(int param) {  }
};
bool baz(int param) { }

foo foo_instance;
auto delegate = CREATE_DELEGATE(&foo::bar, &foo_instance);
delegate(42);
delegate = CREATE_DELEGATE(&baz);
delegate(90210);
Delegate<bool(int)> call_me_maybe = delegate;
call_me_maybe(31337);

Built with maximum warnings on gcc, clang, msvc, full test coverage

TODO

  • Add Catch / Lest tests
  • add gcc/arm build
  • add cpplint

About

A short version of Elbert Mai's lightweight delegates/callbacks in C++11

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.