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

[C++] Indexing table instance #8445

Open
penyung opened this issue Dec 11, 2024 · 1 comment
Open

[C++] Indexing table instance #8445

penyung opened this issue Dec 11, 2024 · 1 comment

Comments

@penyung
Copy link

penyung commented Dec 11, 2024

Hi all,
I have a table that is widely used by other tables. I want to index some of table instances by its offset from buffer start and save in a vector so that receiver can quickly access these instances without traversing from root. I want to know what's the best way to do indexing.

Offset<T> is not suitable to be index by the documents.
One possible solution is using GetTemporaryPointer to obtain the pointer and calculate the offset when creating the table, but its comments say "Creating new objects will lead to reallocations and invalidates the pointer". So it doesn't seem to work.

I guest the best way is do indexing by traversing root after finishing the whole fbs?

@penyung penyung changed the title Indexing table instance [C++] Indexing table instance Dec 11, 2024
@penyung
Copy link
Author

penyung commented Dec 18, 2024

I think my true problem is how to get offset from buffer start when building table instance.
It seems there is no way to get final value when building.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant