Skip to content

Commit

Permalink
meta: internal changes
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Jul 25, 2024
1 parent 7b0b5ad commit 42a3d21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ TODO:
* deprecate meta properties in favor of custom data
* make meta objects safe to use with null nodes
* natvis for meta_custom
* meta: vectors for details and props
* suppress -Wself-move on CI with g++13
10 changes: 5 additions & 5 deletions src/entt/meta/factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ class basic_meta_factory {
}
}

void custom(const id_type type, std::shared_ptr<void> udata) {
void custom(meta_custom_node node) {
if(bucket == parent) {
internal::meta_context::from(*ctx).value[parent].custom = {type, std::move(udata)};
internal::meta_context::from(*ctx).value[parent].custom = std::move(node);
} else if(is_data) {
details->data[bucket].custom = {type, std::move(udata)};
details->data[bucket].custom = std::move(node);
} else {
details->func[bucket].custom = {type, std::move(udata)};
details->func[bucket].custom = std::move(node);
}
}

Expand Down Expand Up @@ -544,7 +544,7 @@ class meta_factory: private internal::basic_meta_factory {
*/
template<typename Value, typename... Args>
meta_factory custom(Args &&...args) {
base_type::custom(type_id<Value>().hash(), std::make_shared<Value>(std::forward<Args>(args)...));
base_type::custom(internal::meta_custom_node{type_id<Value>().hash(), std::make_shared<Value>(std::forward<Args>(args)...)});
return *this;
}
};
Expand Down

0 comments on commit 42a3d21

Please sign in to comment.