You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The open source project I work on is working on migrating away from RapidJSON to this nlohmann/json. To get function parity, I need to be a custom input adapter to track line numbers by counting newline characters. (In case there is an error in parsing, we can print out "error at line number blah" on the JSON string, and the custom object build on SAX parsing has references to line numbers).
However, I'm struggling to see how I can implement a custom input adapter to pass into sax_parse, without running into a failure that there is no matching constructor for input_adapter here
auto ia = detail::input_adapter(std::forward<InputType>(i));
.
Ideally, I would like to subclass iterator_input_adapter, override get_character() to also track how many newline characters are seen, and pass this custom input adapter to sax_parse.
I have read through #834, and don't see a resolution here. Maybe there is a better way to achieve what I need?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
The open source project I work on is working on migrating away from RapidJSON to this nlohmann/json. To get function parity, I need to be a custom input adapter to track line numbers by counting newline characters. (In case there is an error in parsing, we can print out "error at line number blah" on the JSON string, and the custom object build on SAX parsing has references to line numbers).
However, I'm struggling to see how I can implement a custom input adapter to pass into
sax_parse, without running into a failure that there is no matching constructor forinput_adapterherejson/include/nlohmann/json.hpp
Line 6813 in d8d8cbf
Ideally, I would like to subclass
iterator_input_adapter, overrideget_character()to also track how many newline characters are seen, and pass this custom input adapter tosax_parse.I have read through #834, and don't see a resolution here. Maybe there is a better way to achieve what I need?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions