Skip to content

Instantly share code, notes, and snippets.

@Cylix
Last active October 19, 2020 05:34
Show Gist options
  • Save Cylix/f613ecaf4c9bed94ec1246a9f2fa9f32 to your computer and use it in GitHub Desktop.
Save Cylix/f613ecaf4c9bed94ec1246a9f2fa9f32 to your computer and use it in GitHub Desktop.
Reflection in C++14 - Registration #1
template <typename T>
class reflectable {
public:
//! constructor of a reflectable class where we can process the registration
reflectable(const std::string& class_name) : name(class_name) {
reflection_manager::get_instance().register_reflectable(*this);
}
//! function to get reflectable name
const std::string& get_name(void) const {
return this->name;
}
private:
std::string name;
};
static reflectable<SomeClass> register_some_class("SomeClass");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment