visit info function

This commit is contained in:
BlackMATov
2021-07-04 22:35:01 +07:00
parent 89e47e5388
commit 699f6beb76
8 changed files with 55 additions and 0 deletions

View File

@@ -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<class_info> get_class(std::string_view id) const {
return detail::find_opt(classes_, id);
}

View File

@@ -36,6 +36,11 @@ namespace meta_hpp
}
}
template < typename F >
void visit(F&& f) const {
each_data(f);
}
std::optional<data_info> get_data(std::string_view id) const {
return detail::find_opt(datas_, id);
}

View File

@@ -91,6 +91,11 @@ namespace meta_hpp
}
}
template < typename F >
void visit(F&& f) const {
each_data(f);
}
std::optional<data_info> get_data(std::string_view id) const {
return detail::find_opt(datas_, id);
}

View File

@@ -96,6 +96,11 @@ namespace meta_hpp
}
}
template < typename F >
void visit(F&& f) const {
each_data(f);
}
std::optional<data_info> get_data(std::string_view id) const {
return detail::find_opt(datas_, id);
}

View File

@@ -22,6 +22,17 @@
#include <utility>
#include <variant>
namespace meta_hpp
{
template < typename... Ts >
struct overloaded : Ts... {
using Ts::operator()...;
};
template < typename... Ts >
overloaded(Ts...) -> overloaded<Ts...>;
}
namespace meta_hpp
{
struct family_id {

View File

@@ -159,6 +159,11 @@ namespace meta_hpp
}
}
template < typename F >
void visit(F&& f) const {
each_data(f);
}
std::optional<data_info> get_data(std::string_view id) const {
return detail::find_opt(datas_, id);
}

View File

@@ -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<class_info> get_class(std::string_view id) const {
return detail::find_opt(classes_, id);
}

View File

@@ -87,6 +87,11 @@ namespace meta_hpp
}
}
template < typename F >
void visit(F&& f) const {
each_data(f);
}
std::optional<data_info> get_data(std::string_view id) const {
return detail::find_opt(datas_, id);
}