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

Duplicate subtree and its data #473

Open
Jakz opened this issue Sep 29, 2024 · 0 comments
Open

Duplicate subtree and its data #473

Jakz opened this issue Sep 29, 2024 · 0 comments

Comments

@Jakz
Copy link

Jakz commented Sep 29, 2024

I'm trying to create a copy of a subtree of ryml::Tree instance which should outlive the original object. I'm using:

tree.rootref() |= ryml::MAP;
tree.duplicate_children(src.tree(), src.id(), tree.root_id(), ryml::NONE);

I can see that this correctly works but once the original tree which contains src is destroyed then the new subtree content is pointing to a dangling buffer.

Is there a simple yet efficient way to duplicate children on its own buffer, owned by the new tree?

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