deploy: a47170346a
This commit is contained in:
1 parent
b36f8a9821
commit
11a863958e
1180 files changed
+14211
-6025
No files matched your search
+10
-3
@@ -20,7 +20,7 @@ json j(true);
|
||||
|
||||
yield different results (`[true]` vs. `true`)?
|
||||
|
||||
This is a known issue, and -- even worse -- the behavior differs between GCC and Clang. The "culprit" for this is the library's constructor overloads for initializer lists to allow syntax like
|
||||
This is a known issue, and — even worse — the behavior differs between GCC and Clang. The "culprit" for this is the library's constructor overloads for initializer lists to allow syntax like
|
||||
|
||||
```
|
||||
json array = {1, 2, 3, 4};
|
||||
@@ -166,7 +166,7 @@ Question
|
||||
|
||||
How do I check if a key exists, without changing the object?
|
||||
|
||||
Use `contains` or `find`. Do not test with the non-const `operator[]`: like `std::map::operator[]`, it inserts a `null` value for a missing key. See [Does this key exist?](https://json.nlohmann.me/features/element_access/#does-this-key-exist).
|
||||
Use `contains` or `find`. Do not test with the non-const `operator[]`: like `std::map::operator[]`, it inserts a `null` value for a missing key. See [Does this key exist?](https://json.nlohmann.me/features/element_access/#does-this-key-exist). For choosing between `value`, `contains`/`find`, `at`, `operator[]`, and JSON Pointer, see the decision flow in [Element access](https://json.nlohmann.me/features/element_access/index.md).
|
||||
|
||||
### Reading a value with a fallback
|
||||
|
||||
@@ -352,7 +352,7 @@ Question
|
||||
|
||||
Is `basic_json` thread-safe?
|
||||
|
||||
No. `basic_json` provides no built-in synchronization, the same as `std::map` or `std::vector`. Concurrent reads of the same value from multiple threads are safe, as are concurrent (non-overlapping) accesses to independent `json` objects. However, any concurrent write to a `json` object -- or a concurrent read while another thread writes to the same object -- is a data race and requires external synchronization (e.g., a `std::mutex`) by the caller.
|
||||
No. `basic_json` provides no built-in synchronization, the same as `std::map` or `std::vector`. Concurrent reads of the same value from multiple threads are safe, as are concurrent (non-overlapping) accesses to independent `json` objects. However, any concurrent write to a `json` object — or a concurrent read while another thread writes to the same object — is a data race and requires external synchronization (e.g., a `std::mutex`) by the caller.
|
||||
|
||||
### Schema validation
|
||||
|
||||
@@ -513,3 +513,10 @@ Questions
|
||||
- Why does the code not compile with MinGW or Android SDK?
|
||||
|
||||
This is not an issue with the code, but rather with the compiler itself. On Android, use a current NDK (see above). For MinGW, please refer to [this site](http://tehsausage.com/mingw-to-string) and [this discussion](https://github.com/nlohmann/json/issues/136) for information on how to fix this bug.
|
||||
|
||||
## See also
|
||||
|
||||
- [`basic_json`](https://json.nlohmann.me/api/basic_json/index.md) - the main class and all its member functions
|
||||
- [Macros](https://json.nlohmann.me/api/macros/index.md) - reference of all macros
|
||||
- [Exceptions](https://json.nlohmann.me/home/exceptions/index.md) - all exceptions and their error codes
|
||||
- [Features](https://json.nlohmann.me/features/index.md) - overview of all features
|
||||
Reference in new issue
Block a user