Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for invocation and node iteration on pointer types #4

Merged
merged 2 commits into from May 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/meta/factory.hpp
Expand Up @@ -89,9 +89,11 @@ class factory {
std::is_member_object_pointer_v<Type>,
std::is_member_function_pointer_v<Type>,
std::extent_v<Type>,
[](void* ptr) -> void* { return ptr; },
[]() -> meta::type { return internal::type_info<std::remove_pointer_t<Type>>::resolve(); },
&internal::destroy<Type>,
[]() -> meta::type { return &node; }
[]() -> meta::type { return &node; },
[]() -> internal::type_node* { return internal::type_info<std::remove_pointer_t<Type>>::resolve(); }
};

node.name = name;
Expand Down Expand Up @@ -620,7 +622,7 @@ inline bool unregister() noexcept {
*/
template<typename Type>
inline type resolve() noexcept {
return internal::type_info<Type>::resolve()->clazz();
return internal::type_info<Type>::resolve()->self();
}


Expand All @@ -634,7 +636,7 @@ inline type resolve(const char *str) noexcept {
return node->id == id;
}, internal::type_info<>::type);

return curr ? curr->clazz() : type{};
return curr ? curr->self() : type{};
}


Expand All @@ -646,7 +648,7 @@ inline type resolve(const char *str) noexcept {
template<typename Op>
void resolve(Op op) noexcept {
internal::iterate([op = std::move(op)](auto *node) {
op(node->clazz());
op(node->self());
}, internal::type_info<>::type);
}

Expand Down