-
for this code #include <sourcemeta/jsontoolkit/jsonl.h>
#include <cassert>
#include <sstream>
#include <iostream>
int main()
{
std::istringstream stream{
"{ \"foo\": 1 }\n{ \"bar\": 2 }\n{ \"baz\": 3 }"};
for (const auto &document : sourcemeta::jsontoolkit::JSONL{stream})
{
assert(document.is_object());
sourcemeta::jsontoolkit::prettify(document, std::cout);
std::cout << '\n';
}
} I am getting this error
GCC version : 11.4.0 |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
But tests for this are running without throwing errors, i dont know why ? |
Beta Was this translation helpful? Give feedback.
-
@MeastroZI On what OS are you on?
|
Beta Was this translation helpful? Give feedback.
-
Ah, it seems the issue isn't with the compiler itself, but rather with the default C++ standard, which is set to 17 on my system running Ubuntu 22 here is the edited CMakeList.txt which work fine
|
Beta Was this translation helpful? Give feedback.
-
Interesting! A more backwards compatible approach would be to use the spaceship operator instead of implementing specific ones like we do now. I believe that would make it work on C++17 too. See #509 |
Beta Was this translation helpful? Give feedback.
-
Hmm, and one more thing: the contains method for maps is not available for the standard version less than 20. So, I'm also encountering an error for that |
Beta Was this translation helpful? Give feedback.
-
Yep. The documentation (https://jsontoolkit.sourcemeta.com/) clarifies that C++20 or later is expected. Probably a lot more would be needed to make it work on C++17 which is likely not worth it |
Beta Was this translation helpful? Give feedback.
Ah, it seems the issue isn't with the compiler itself, but rather with the default C++ standard, which is set to 17 on my system running Ubuntu 22
here is the edited CMakeList.txt which work fine