Created
October 19, 2020 05:58
-
-
Save Cylix/6ece71afdd3ca3a8d385a1f00b289b38 to your computer and use it in GitHub Desktop.
Reflection in C++14 - Reflection #2
This file contains 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... Params> | |
struct reflection_maker; | |
template <typename ReturnType, typename... Params> | |
struct reflection_maker<ReturnType(Params...)> { | |
static ReturnType invoke(const std::string& class_name, const std::string& function_name, Params... params) { | |
return reflection_manager::get_instance().reflect<ReturnType, Params...>(class_name, function_name, params...); | |
} | |
}; | |
int main(void) { | |
reflection_maker<void(int, double)>::invoke("SomeClass", "some_fct", 1, 4.2); // will call SomeClass().some_fct(1, 4.2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment