Skip to content

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

Closed

Description

@kelaicai

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!

Activity

  1. nickaein commented on Jan 19, 2020

    @nickaein
    Contributor

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

  2. nlohmann commented on Jan 19, 2020

    @nlohmann
    Owner
  3. pboettch commented on Jan 28, 2020

    @pboettch
    Contributor

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    solution: invalidthe issue is not related to the library

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions