Skip to content

sergiimk/dynamic_delegates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynamic Delegates

This library is a further development of the Don Clugston’s project “Member Function Pointers and the Fastest Possible C++ Delegates” (http://www.codeproject.com/KB/cpp/FastDelegate.aspx).

Modification are mainly aimed to make this library useful for implementing the reflection library and data marshalling systems of SekaiFramework (http://github.com/mikhtonyuk/SekaiFramework).

Invocation feature

Main feature of dynamic delegate library is a possibility to invoke a delegate using an array of arguments. For example:

void F1(int i) { ... }

auto deleg = make_delegate_dynamic(&F1);
int arg = 10;
void* args[] = { &arg };
// Calls F1
deleg.invoke(args, 0 /* no return value */ );

Dynamic invocation extension is separated from original zero-overhead delegates, so that they can be used in places where dynamic invocation is not required.

Performance

Performance of ordinary delegates left unchanged, only slightly reduced compile time thanks to code refactoring.

Dynamic delegates add a virtual table pointer size overhead, plus a virtual call overhead for eack invoke call.

License

This code is distributed free of charge and can be used for any purpose. See LICENSE file for details.

Contacts

If you have any questions – mail me:
Sergey Mikhtonyuk – mikhtonyuk@gmail.com

About

A fast delegates for C++ with dynamic invocation by argument array

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published