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
Describe what you want to achieve.
I want to see a simple example working before integrating into my library. The following code (single file) compiles ok but the json dump is an empty array. It doesn't seem like the to_json and from_json functions are ever being called but I get no warnings or exceptions thrown. How do I modify this code to get something working?
Describe what you tried.
Have tried breaking into separate header file to contain the class and conversion functions and a main file. Have tried using structs instead of classes and providing more constructors as per the instructions.
Describe which system (OS, compiler) you are using.
Ubuntu 18.04, gcc version 9.2.1 20191008
Describe which version of the library you are using (release version, develop branch).
nlohmann_json/3.7.0
Thanks in advance
The text was updated successfully, but these errors were encountered:
Instead of reserve(), you must do resize() (or reserve() + push_back()). A reserve() on vector only changes the underlying buffer size and doesn't logically increases the size of the vector. Therefore, your vectors are considered empty. More info on difference between resize() vs. reserve().
I want to see a simple example working before integrating into my library. The following code (single file) compiles ok but the json dump is an empty array. It doesn't seem like the to_json and from_json functions are ever being called but I get no warnings or exceptions thrown. How do I modify this code to get something working?
I am using conan to provide nlohmann_json using this
conanfile.txt
and my
CMakeLists.txt
file is simplyDescribe what you tried.
Have tried breaking into separate header file to contain the class and conversion functions and a main file. Have tried using structs instead of classes and providing more constructors as per the instructions.
Describe which system (OS, compiler) you are using.
Ubuntu 18.04, gcc version 9.2.1 20191008
Describe which version of the library you are using (release version, develop branch).
nlohmann_json/3.7.0
Thanks in advance
The text was updated successfully, but these errors were encountered: