Niels Lohmann
af23f07f8c
Fix parse(container, function) for plain functions as callback
...
Passing a plain function or function pointer as parser callback, as in json::parse(std::string("[1,2]"), cb), stopped compiling in C++11/14/17. The iterator+sentinel overloads added for C++20 ranges are constrained by can_compare_ne, i.e. whether `first != last` is well-formed. The callback's parameter types make basic_json an associated class, so ADL finds the friend operator!=(const_reference, ScalarType): the container converts to basic_json and the function pointer is a scalar. The sentinel overload was thereby selected and failed hard in its body.
can_compare_ne now excludes function pointers and functions as sentinel type, since a callback is never a sentinel. This shared constraint guards parse, accept, sax_parse and all from_* overloads. Checking IteratorType via std::iterator_traits was avoided on purpose: it would instantiate iterator_traits for every two-argument call, which is a hard error on standard libraries with a non-SFINAE-friendly iterator_traits.
Signed-off-by: Niels Lohmann <mail@nlohmann.me >
2026-11-11 09:24:05 +01:00
..
2026-10-17 08:28:28 +02:00
2026-10-11 08:24:31 +02:00
2026-10-11 08:24:31 +02:00
2026-10-14 17:38:36 +02:00
2026-10-15 20:04:57 +02:00
2026-01-01 20:00:39 +01:00
2026-10-25 12:07:51 +01:00
2026-10-15 20:04:57 +02:00
2026-10-15 20:04:57 +02:00
2026-10-15 20:04:57 +02:00
2026-10-15 20:04:57 +02:00
2026-10-25 12:07:51 +01:00
2026-10-15 20:04:57 +02:00
2026-10-15 20:04:57 +02:00
2026-10-15 20:04:57 +02:00
2026-11-01 17:25:26 +01: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-11 08:21:13 +02:00
2026-09-16 20:15:46 +02:00
2026-10-06 22:53:03 +02:00
2026-11-04 17:13:16 +01:00
2026-10-15 20:01:20 +02:00
2026-11-07 10:10:21 +01:00
2026-11-02 17:48:16 +01:00
2026-10-01 07:37:47 +02:00
2026-10-14 17:38:37 +02:00
2026-10-09 17:05:36 +02:00
2026-10-04 17:18:19 +02:00
2026-11-04 17:13:25 +01:00
2026-10-17 08:28:28 +02:00
2026-10-17 08:28:28 +02:00
2026-11-04 23:42:17 +01:00
2026-11-02 17:54:38 +01:00
2026-10-07 07:39:05 +02:00
2026-11-10 22:30:31 +01:00
2026-09-16 20:15:46 +02:00
2026-10-01 07:37:47 +02:00
2026-11-02 18:25:44 +01:00
2026-09-27 14:19:22 +02:00
2026-01-01 20:00:39 +01:00
2026-11-03 13:42:46 +01:00
2026-11-11 09:24:05 +01:00
2026-10-15 20:01:21 +02:00
2026-01-01 20:00:39 +01:00
2026-10-25 06:17:51 +01:00
2026-10-16 19:16:21 +02:00
2026-11-10 07:08:44 +01:00
2026-09-11 08:22:50 +02:00
2026-11-02 17:48:43 +01:00
2026-10-06 07:22:55 +02:00
2026-11-02 17:54:38 +01:00
2026-11-02 17:48:03 +01:00
2026-10-13 17:16:52 +02:00
2026-10-11 08:24:31 +02:00
2026-10-11 08:24:31 +02:00
2026-11-02 17:54:38 +01:00
2026-10-11 08:24:31 +02:00
2026-10-11 08:24:31 +02:00
2026-11-02 17:54:38 +01:00
2026-11-03 13:42:46 +01:00
2026-10-08 16:11:16 +02:00
2026-10-06 07:22:55 +02:00
2026-11-10 22:30:31 +01:00
2026-11-02 17:50:40 +01:00
2026-10-07 16:37:19 +02:00
2026-11-02 17:54:38 +01:00
2026-09-30 20:53:56 +02:00
2026-10-25 12:07:51 +01:00
2026-09-30 20:07:06 +02:00
2026-10-25 12:07:51 +01:00
2026-10-04 17:54:05 +02:00
2026-10-04 17:54:05 +02:00
2026-10-25 12:07:51 +01:00
2026-11-07 14:27:52 +01:00
2026-10-25 12:07:51 +01:00
2026-11-01 17:23:27 +01:00
2026-10-25 12:07:51 +01:00
2026-01-01 20:00:39 +01:00
2026-09-09 09:52:58 +02:00
2026-10-04 22:11:34 +02:00
2026-10-16 19:16:21 +02:00
2026-11-02 17:54:38 +01:00
2026-01-01 20:00:39 +01:00
2026-11-02 17:54:38 +01:00
2026-11-02 17:54:38 +01:00
2026-11-01 20:42:58 +01:00
2026-11-02 17:54:38 +01:00
2026-10-30 15:19:42 +01:00
2026-11-02 17:54:38 +01:00
2026-11-02 17:54:38 +01:00
2026-10-28 19:46:28 +01:00
2026-11-02 17:54:38 +01:00
2026-11-02 17:54:38 +01:00
2026-11-10 15:24:33 +01:00
2026-11-02 17:54:38 +01:00
2026-11-01 17:21:06 +01:00
2026-11-02 17:54:38 +01:00
2026-11-03 13:42:46 +01:00
2026-10-17 08:28:28 +02:00
2026-10-17 08:28:28 +02:00
2026-11-02 17:54:38 +01:00
2026-11-03 19:17:41 +01:00
2026-10-12 09:33:43 +02:00
2026-10-26 17:11:55 +01:00
2026-01-01 20:00:39 +01:00
2026-10-04 17:18:19 +02:00
2026-11-03 13:42:46 +01:00
2026-10-21 08:36:31 +00:00
2026-11-02 18:25:44 +01:00
2026-10-25 12:07:51 +01:00
2026-10-25 12:07:51 +01: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-10-09 16:56:14 +02:00
2026-11-03 13:42:46 +01:00
2026-10-04 17:18:19 +02:00
2026-10-27 14:31:31 +01:00
2026-10-19 22:00:58 +02:00
2026-10-19 22:00:31 +02:00
2026-10-01 07:33:07 +02:00
2026-01-01 20:00:39 +01:00
2026-11-03 13:42:46 +01:00
2026-11-04 17:13:16 +01:00
2026-10-25 12:07:51 +01:00
2026-10-15 20:04:42 +02:00
2026-10-31 13:54:45 +01:00
2026-10-25 12:07:51 +01:00
2026-10-22 20:22:53 +02:00
2026-11-03 13:42:46 +01:00
2026-10-16 19:16:21 +02:00
2026-10-16 19:16:21 +02:00
2026-11-02 17:54:38 +01:00
2026-10-15 22:42:46 +02:00
2026-10-04 11:50:42 +02:00
2026-11-04 17:13:16 +01:00
2026-01-01 20:00:39 +01:00
2026-09-25 20:44:30 +02:00
2026-10-06 22:33:29 +02:00
2026-11-01 17:23:27 +01:00
2026-10-01 07:37:47 +02:00
2026-01-01 20:00:39 +01:00
2026-10-04 17:18:19 +02:00
2026-09-30 22:49:24 +02:00
2026-10-01 07:37:47 +02:00