Created
March 2, 2014 06:20
-
-
Save GregoryHlavac/9302699 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename ReturnType, typename... ArgumentTypes> | |
struct FunctionGear | |
{ | |
typedef std::function<ReturnType(ArgumentTypes...)> NativeFunction; | |
FunctionGear(NativeFunction nf) : mNativeFunction(nf){} | |
void Invoke(const v8::FunctionCallbackInfo<v8::Value> args) | |
{ | |
size_t currentArgumentIndex = args.Length() - 1; | |
mNativeFunction(ConvertTypeAtIndex<ArgumentTypes>(args.GetIsolate(), args, currentArgumentIndex)...); | |
} | |
private: | |
NativeFunction mNativeFunction; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment