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

why root_schema be implemented as unique_ptr in json-validator.cpp,could I use it as shared_ptr? #1908

Closed
kelaicai opened this issue Jan 19, 2020 · 3 comments
Labels
solution: invalid the issue is not related to the library

Comments

@kelaicai
Copy link

hi! firend, I use original json-validator object in multithread enviroment, but core in second get validator, and I see the source code,find it pass by right value reference and use a unique_ptr,i want to know : why use it as a unique_ptr ? forgive my poor English,thx!

@nickaein
Copy link
Contributor

I didn't quite understand the problem but you can cast a unique_ptr to shared_ptr (example).

@nlohmann
Copy link
Owner

Do you mean this project: https://github.com/pboettch/json-schema-validator ?

cc @pboettch

@nlohmann nlohmann added the solution: invalid the issue is not related to the library label Jan 25, 2020
@pboettch
Copy link
Contributor

pboettch commented Jan 28, 2020

@kelaicai Please open an issue here.

If you want to use the validator in different threads, just do so. When validating a JSON-document the validator-instance and the json-instance are considered const. Nothing is modified. So it is thread-safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution: invalid the issue is not related to the library
Projects
None yet
Development

No branches or pull requests

4 participants