-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I forward nlohmann::json declaration? #899
Comments
This is not was I was hoping for, but thanks for the answer anyway. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: