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

Missing definition for ecs_meta_move #723

Closed
sro5h opened this issue May 28, 2022 · 1 comment
Closed

Missing definition for ecs_meta_move #723

sro5h opened this issue May 28, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@sro5h
Copy link
Contributor

sro5h commented May 28, 2022

Describe the bug
The definition of the function ecs_meta_move seems to be missing from flecs.c and meta.c. Thus usage of the function results in a linker error.

Expected behavior
No linker error.

Additional context
Should not really matter, but i am running Fedora 35 with gcc 11.3.1

@sro5h sro5h added the bug Something isn't working label May 28, 2022
SanderMertens added a commit that referenced this issue Jun 30, 2022
@SanderMertens
Copy link
Owner

Fixed!

I made a few changes:

  • renamed the function to ecs_meta_elem
  • it can only be used with collections

Rationale: implementing an ecs_meta_move for structs could not be made more efficient (at least not without introducing additional data structures) than calling ecs_meta_next multiple times. This is because of nested structs, and the list of operations being "flattened": you can't easily jump over 3 members without knowing how many members those members have. Instead, the ecs_meta_member function provides an O(1) way to jump around a struct.

ecs_meta_move (now ecs_meta_elem) does make sense for collections, where "jump to the nth element" is a simple O(1) operation where the cursor just sets the index to the current element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants