This commit is contained in:
nlohmann committed 2026-11-12 11:46:38 +00:00
1 parent 8ddeea7128
commit 5097c20962
516 files changed
+7306 -5984

No files matched your search

+2
View File
@@ -51,6 +51,8 @@ Comparing `NaN`
1. Comparing a `NaN` with another `NaN`.
1. Comparing a `NaN` and any other number.
For arrays and objects, the elements are compared in order. If the comparison reaches a `NaN` and a number (or another `NaN`) before any other difference, the result depends on the language standard. Before C++20, the pair counts as equivalent and the following elements (or the sizes) decide: for instance, `[NaN] < [1, NaN]` and `[1] <= [NaN]` are `true`. Since C++20, the whole comparison is unordered, and `<`, `<=`, `>`, and `>=` all yield `false`. Otherwise (for example `[1, NaN] < [2, NaN]`, or objects whose keys differ), the result is the same for all language standards. The same program can therefore order such values differently when it is compiled with a different language standard.
Operator overload resolution
Since C++20 overload resolution will consider the *rewritten candidate* generated from [`operator<=>`](https://json.nlohmann.me/api/basic_json/operator_spaceship/index.md).