Skip to content

Instantly share code, notes, and snippets.

@xaxxon
Last active January 1, 2016 03:43
Show Gist options
  • Save xaxxon/97c75218891e439ce147 to your computer and use it in GitHub Desktop.
Save xaxxon/97c75218891e439ce147 to your computer and use it in GitHub Desktop.
template<typename ... CONSTRUCTOR_PARAMETER_TYPES>
static void v8_constructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
T * new_cpp_object = call_cpp_constructor<CONSTRUCTOR_PARAMETER_TYPES...>(args, std::index_sequence_for<CONSTRUCTOR_PARAMETER_TYPES...>());
// other stuff in here removed
}
template <typename ...Fs, size_t...ns, class WHY>
static T * call_cpp_constructor(const WHY & args, std::index_sequence<ns...>){
return new T(CastToNative<Fs>()(args[ns])...);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment