diff --git a/headers/meta.hpp/meta_class_info.hpp b/headers/meta.hpp/meta_class_info.hpp index c2241c0..488346d 100644 --- a/headers/meta.hpp/meta_class_info.hpp +++ b/headers/meta.hpp/meta_class_info.hpp @@ -77,6 +77,16 @@ namespace meta_hpp } } + template < typename F > + void visit(F&& f) const { + each_class(f); + each_data(f); + each_field(f); + each_function(f); + each_method(f); + each_variable(f); + } + std::optional get_class(std::string_view id) const { return detail::find_opt(classes_, id); } diff --git a/headers/meta.hpp/meta_data_info.hpp b/headers/meta.hpp/meta_data_info.hpp index b9cbbae..fc32ab4 100644 --- a/headers/meta.hpp/meta_data_info.hpp +++ b/headers/meta.hpp/meta_data_info.hpp @@ -36,6 +36,11 @@ namespace meta_hpp } } + template < typename F > + void visit(F&& f) const { + each_data(f); + } + std::optional get_data(std::string_view id) const { return detail::find_opt(datas_, id); } diff --git a/headers/meta.hpp/meta_field_info.hpp b/headers/meta.hpp/meta_field_info.hpp index e4b9f00..6e4f9bb 100644 --- a/headers/meta.hpp/meta_field_info.hpp +++ b/headers/meta.hpp/meta_field_info.hpp @@ -91,6 +91,11 @@ namespace meta_hpp } } + template < typename F > + void visit(F&& f) const { + each_data(f); + } + std::optional get_data(std::string_view id) const { return detail::find_opt(datas_, id); } diff --git a/headers/meta.hpp/meta_function_info.hpp b/headers/meta.hpp/meta_function_info.hpp index 06dbaf2..0d9c0e9 100644 --- a/headers/meta.hpp/meta_function_info.hpp +++ b/headers/meta.hpp/meta_function_info.hpp @@ -96,6 +96,11 @@ namespace meta_hpp } } + template < typename F > + void visit(F&& f) const { + each_data(f); + } + std::optional get_data(std::string_view id) const { return detail::find_opt(datas_, id); } diff --git a/headers/meta.hpp/meta_fwd.hpp b/headers/meta.hpp/meta_fwd.hpp index f5b4bbd..2a607b4 100644 --- a/headers/meta.hpp/meta_fwd.hpp +++ b/headers/meta.hpp/meta_fwd.hpp @@ -22,6 +22,17 @@ #include #include +namespace meta_hpp +{ + template < typename... Ts > + struct overloaded : Ts... { + using Ts::operator()...; + }; + + template < typename... Ts > + overloaded(Ts...) -> overloaded; +} + namespace meta_hpp { struct family_id { diff --git a/headers/meta.hpp/meta_method_info.hpp b/headers/meta.hpp/meta_method_info.hpp index 6f31031..894ca8b 100644 --- a/headers/meta.hpp/meta_method_info.hpp +++ b/headers/meta.hpp/meta_method_info.hpp @@ -159,6 +159,11 @@ namespace meta_hpp } } + template < typename F > + void visit(F&& f) const { + each_data(f); + } + std::optional get_data(std::string_view id) const { return detail::find_opt(datas_, id); } diff --git a/headers/meta.hpp/meta_namespace_info.hpp b/headers/meta.hpp/meta_namespace_info.hpp index a27584c..4df3cc3 100644 --- a/headers/meta.hpp/meta_namespace_info.hpp +++ b/headers/meta.hpp/meta_namespace_info.hpp @@ -65,6 +65,15 @@ namespace meta_hpp } } + template < typename F > + void visit(F&& f) const { + each_class(f); + each_data(f); + each_function(f); + each_namespace(f); + each_variable(f); + } + std::optional get_class(std::string_view id) const { return detail::find_opt(classes_, id); } diff --git a/headers/meta.hpp/meta_variable_info.hpp b/headers/meta.hpp/meta_variable_info.hpp index f4e2f7b..1d0a20e 100644 --- a/headers/meta.hpp/meta_variable_info.hpp +++ b/headers/meta.hpp/meta_variable_info.hpp @@ -87,6 +87,11 @@ namespace meta_hpp } } + template < typename F > + void visit(F&& f) const { + each_data(f); + } + std::optional get_data(std::string_view id) const { return detail::find_opt(datas_, id); }