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

to_{binary format} does not provide a mechanism for specifying a custom allocator for the returned type. #2982

Closed
davidchisnall opened this issue Aug 29, 2021 · 2 comments · Fixed by #2989

Comments

@davidchisnall
Copy link

What is the issue you have?

basic_json provides an allocator that is passed to the types used for deserialisation, but there is no way of specify an allocator to use for the object that is returned by to_bson, to_cbor, and so on. The adaptor for output is explicitly specialised on std::vector without providing a mechanism for specifying the allocator that std::vector uses.

@nlohmann
Copy link
Owner

You are right, allocators are currently not supported. I think it would be possible to add such support by adjusting the output and input iterators.

@nlohmann
Copy link
Owner

nlohmann commented Sep 2, 2021

#2989 is ready to review.

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

Successfully merging a pull request may close this issue.

2 participants