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
I'm having a question - let me describe the scenario:
I plan to use JSON for Modern C++ to serialize objects used in a library. Other projects using this library should have no knowledge about the method used to save data. So it should be possible to replace the mechanismn by something else in the future without any change of code on the client side. Therefor I don't want to include json.hpp in my library header files.
But forward declaration failed - maybe you can help me to do it the right way. I tried
namespace nlohmann {
class json;
}
Error: using typedef-name 'using json = class nlohmann::basic_json<>' after 'class'
Then I tried
namespace nlohmann {
template<class T> class basic_json;
using json = basic_json<>;
}
Error: wrong number of template arguments (0, should be 1)
I'm aiming to create an abstract template, which can be specialized in classes to be serialized.
I would be happy to have an answer for my question or any suggestions how to achieve my goal. Mybe you could add info about forward declaration to the description.
The text was updated successfully, but these errors were encountered:
Hello everybody,
I'm having a question - let me describe the scenario:
I plan to use JSON for Modern C++ to serialize objects used in a library. Other projects using this library should have no knowledge about the method used to save data. So it should be possible to replace the mechanismn by something else in the future without any change of code on the client side. Therefor I don't want to include json.hpp in my library header files.
But forward declaration failed - maybe you can help me to do it the right way. I tried
Error: using typedef-name 'using json = class nlohmann::basic_json<>' after 'class'
Then I tried
Error: wrong number of template arguments (0, should be 1)
I'm aiming to create an abstract template, which can be specialized in classes to be serialized.
Then I want to use it this way:
I would be happy to have an answer for my question or any suggestions how to achieve my goal. Mybe you could add info about forward declaration to the description.
The text was updated successfully, but these errors were encountered: