Niels Lohmann
df27cc3d4c
Add scalar-on-left overloads for legacy discarded comparisons in C++20 ( #5682 )
...
With JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON=1 and C++20, a scalar on
the left-hand side of <= or >= (e.g., `1 <= discarded`) yielded false
instead of the documented true. The C++20 legacy block only had member
operators, which are only candidates when the basic_json is the left
operand; for a scalar on the left, overload resolution picked the
candidate rewritten from operator<=>, which does not emulate the legacy
behavior. The C++17 branch already has scalar-on-the-left friend
overloads for <= and >=; add the equivalent pair to the C++20 legacy
block.
Added a regression test to tests/src/unit-comparison.cpp covering all
four operand orders for both operators.
Fixes #5665 .
Signed-off-by: Niels Lohmann <mail@nlohmann.me >
2026-10-04 11:46:21 +02:00
..
2026-01-01 20:00:39 +01:00
2026-10-01 07:33:07 +02:00
2026-10-01 07:33:07 +02:00
2026-10-01 07:33:07 +02:00
2026-10-01 07:33:07 +02:00
2026-10-01 07:33:07 +02:00
2026-10-01 07:33:07 +02:00
2026-10-01 07:33:07 +02:00
2026-01-01 20:00:39 +01:00
2026-10-01 07:33:07 +02:00
2026-10-01 07:33:07 +02:00
2026-09-16 20:15:46 +02:00
2026-09-27 14:28:38 +02:00
2026-10-01 07:33:07 +02:00
2026-07-08 16:40:58 +02:00
2026-10-02 11:23:55 +02:00
2026-10-02 11:23:55 +02:00
2026-10-01 07:37:47 +02:00
2026-09-27 16:56:21 +02:00
2026-10-01 07:37:47 +02:00
2026-10-02 11:23:55 +02:00
2026-10-02 07:47:50 +02:00
2026-09-24 17:05:37 +02:00
2026-10-01 07:37:47 +02:00
2026-09-16 20:15:46 +02:00
2026-10-01 07:37:47 +02:00
2026-10-01 07:37:47 +02:00
2026-09-27 14:19:22 +02:00
2026-01-01 20:00:39 +01:00
2026-10-01 07:37:47 +02:00
2026-10-02 11:23:55 +02:00
2026-10-04 11:46:21 +02:00
2026-01-01 20:00:39 +01:00
2026-09-30 20:07:52 +02:00
2026-10-02 11:23:55 +02:00
2026-09-11 08:22:50 +02:00
2026-10-02 17:25:17 +02:00
2026-09-30 20:07:16 +02:00
2026-10-02 11:23:55 +02:00
2026-09-27 16:56:21 +02:00
2026-09-27 16:56:21 +02:00
2026-10-01 07:33:07 +02:00
2026-09-30 21:36:04 +02:00
2026-10-02 11:23:55 +02:00
2026-09-30 20:53:56 +02:00
2026-09-30 20:06:34 +02:00
2026-09-30 20:07:06 +02:00
2026-09-30 20:07:45 +02:00
2026-09-27 16:56:21 +02:00
2026-07-02 15:59:36 +02:00
2026-10-01 07:37:47 +02:00
2026-01-01 20:00:39 +01:00
2026-09-09 09:52:58 +02:00
2026-09-09 09:52:58 +02:00
2026-01-01 20:00:39 +01:00
2026-10-01 07:33:07 +02:00
2026-01-01 20:00:39 +01:00
2026-10-01 07:37:47 +02:00
2026-09-30 20:06:59 +02:00
2026-10-01 07:37:47 +02:00
2026-10-02 11:23:55 +02:00
2026-10-01 07:37:47 +02:00
2026-01-01 20:00:39 +01:00
2026-10-01 07:37:47 +02:00
2026-10-01 07:33:07 +02:00
2026-09-30 20:08:17 +02:00
2026-09-16 20:15:46 +02:00
2026-09-09 09:48:17 +02:00
2026-09-16 20:15:46 +02:00
2026-10-02 17:25:17 +02:00
2026-09-27 16:56:21 +02:00
2026-09-24 17:01:15 +02:00
2026-09-30 20:06:34 +02:00
2026-10-02 11:23:55 +02:00
2026-10-01 07:37:47 +02:00
2026-10-01 07:33:07 +02:00
2026-01-01 20:00:39 +01:00
2026-10-01 07:33:07 +02:00
2026-10-04 11:46:13 +02:00
2026-10-01 07:37:47 +02:00
2026-10-01 07:37:47 +02:00
2026-09-27 14:19:22 +02:00
2026-01-01 20:00:39 +01:00
2026-01-01 20:00:39 +01:00
2026-08-03 08:35:53 +02:00
2026-10-01 07:33:07 +02:00
2026-01-01 20:00:39 +01:00
2026-09-25 20:44:30 +02:00
2026-10-02 11:23:55 +02:00
2026-09-09 09:50:39 +02:00
2026-09-09 09:50:39 +02:00
2026-09-16 20:16:43 +02:00
2026-09-16 20:16:43 +02:00
2026-09-16 20:16:43 +02:00
2026-10-01 07:37:47 +02:00
2026-01-01 20:00:39 +01:00
2026-10-01 07:33:07 +02:00
2026-09-30 22:49:24 +02:00
2026-10-01 07:37:47 +02:00