mirror of
https://github.com/nlohmann/json.git
synced 2026-09-24 06:10:22 +01:00
Overwork project infrastructure (#5218)
* 📝 overwork project infrastructure Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🐛 fix GCC16 issue Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🐛 fix GCC16 issue Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🐛 only build module for GCC Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🐛 fix build Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 📝 fix documentation Closes #5012: fix the error_handler_t::ignore wording Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 📝 fix documentation Closes #4354: fix "Custom data source" example Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:json)
|
||||
[](https://wandbox.org/permlink/1mp10JbaANo6FUc7)
|
||||
[](https://json.nlohmann.me)
|
||||
[](https://raw.githubusercontent.com/nlohmann/json/master/LICENSE.MIT)
|
||||
[](https://raw.githubusercontent.com/nlohmann/json/develop/LICENSE.MIT)
|
||||
[](https://github.com/nlohmann/json/releases)
|
||||
[](https://repology.org/project/nlohmann-json/versions)
|
||||
[](https://github.com/nlohmann/json/releases)
|
||||
@@ -70,7 +70,7 @@ Other aspects were not so important to us:
|
||||
|
||||
- **Speed**. There are certainly [faster JSON libraries](https://github.com/miloyip/nativejson-benchmark#parsing-time) out there. However, if your goal is to speed up your development by adding JSON support with a single header, then this library is the way to go. If you know how to use a `std::vector` or `std::map`, you are already set.
|
||||
|
||||
See the [contribution guidelines](https://github.com/nlohmann/json/blob/master/.github/CONTRIBUTING.md#please-dont) for more information.
|
||||
See the [contribution guidelines](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md#please-dont) for more information.
|
||||
|
||||
## Sponsors
|
||||
|
||||
@@ -429,6 +429,8 @@ struct MyIterator {
|
||||
using reference = const char&;
|
||||
using iterator_category = std::input_iterator_tag;
|
||||
|
||||
explicit MyIterator(MyContainer* tgt = nullptr) : target(tgt) {}
|
||||
|
||||
MyIterator& operator++() {
|
||||
target->advance();
|
||||
return *this;
|
||||
@@ -450,12 +452,12 @@ MyIterator begin(MyContainer& tgt) {
|
||||
}
|
||||
|
||||
MyIterator end(const MyContainer&) {
|
||||
return {};
|
||||
return MyIterator{};
|
||||
}
|
||||
|
||||
void foo() {
|
||||
MyContainer c;
|
||||
json j = json::parse(c);
|
||||
json j = json::parse(begin(c), end(c));
|
||||
}
|
||||
```
|
||||
|
||||
@@ -756,9 +758,9 @@ int i = 42;
|
||||
json jn = i;
|
||||
auto f = jn.get<double>();
|
||||
// NOT RECOMMENDED
|
||||
double f2 = jb;
|
||||
double f2 = jn;
|
||||
double f3;
|
||||
f3 = jb;
|
||||
f3 = jn;
|
||||
|
||||
// etc.
|
||||
```
|
||||
@@ -1465,7 +1467,7 @@ I deeply appreciate the help of the following people.
|
||||
57. [Jared Grubb](https://github.com/jaredgrubb) supported the implementation of user-defined types.
|
||||
58. [EnricoBilla](https://github.com/EnricoBilla) noted a typo in an example.
|
||||
59. [Martin Hořeňovský](https://github.com/horenmar) found a way for a 2x speedup for the compilation time of the test suite.
|
||||
60. [ukhegg](https://github.com/ukhegg) found proposed an improvement for the examples section.
|
||||
60. [ukhegg](https://github.com/ukhegg) proposed an improvement for the examples section.
|
||||
61. [rswanson-ihi](https://github.com/rswanson-ihi) noted a typo in the README.
|
||||
62. [Mihai Stan](https://github.com/stanmihai4) fixed a bug in the comparison with `nullptr`s.
|
||||
63. [Tushar Maheshwari](https://github.com/tusharpm) added [cotire](https://github.com/sakra/cotire) support to speed up the compilation.
|
||||
@@ -1839,7 +1841,7 @@ The library supports **Unicode input** as follows:
|
||||
This library does not support comments by default. It does so for three reasons:
|
||||
|
||||
1. Comments are not part of the [JSON specification](https://tools.ietf.org/html/rfc8259). You may argue that `//` or `/* */` are allowed in JavaScript, but JSON is not JavaScript.
|
||||
2. This was not an oversight: Douglas Crockford [wrote on this](https://plus.google.com/118095276221607585885/posts/RK8qyGVaGSr) in May 2012:
|
||||
2. This was not an oversight: Douglas Crockford [wrote on this](https://news.ycombinator.com/item?id=3912149) in May 2012:
|
||||
|
||||
> I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn't.
|
||||
>
|
||||
@@ -1847,7 +1849,7 @@ This library does not support comments by default. It does so for three reasons:
|
||||
|
||||
3. It is dangerous for interoperability if some libraries would add comment support while others don't. Please check [The Harmful Consequences of the Robustness Principle](https://tools.ietf.org/html/draft-iab-protocol-maintenance-01) on this.
|
||||
|
||||
However, you can set set parameter `ignore_comments` to true in the `parse` function to ignore `//` or `/* */` comments. Comments will then be treated as whitespace.
|
||||
However, you can set parameter `ignore_comments` to true in the `parse` function to ignore `//` or `/* */` comments. Comments will then be treated as whitespace.
|
||||
|
||||
### Trailing commas
|
||||
|
||||
|
||||
Reference in New Issue
Block a user