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
You technically could workaround that by specializing nlohmann::adl_serializer for MyClass.
Although it would not solve the std::vector problem (unless specializing nlohmann::adl_serializer<std::vector<MyClass>>, which is quite brittle especially if you want to support other containers).
I know that everytime I tried to use const member variables, I ended up removing const.
Since it prevents MoveAssignable and CopyAssignable, lots of containers will not work with it.
Removing const and using MyClass const& when needed seems better.
Hi,
I have this class:
I then want to parse
[{"a":"aaaaa", "b":"bbbbb"}]
to astd::vector<MyClass>
.I tried using the to_json/from_json approach in but I can't because
The other approach using
also doesn't work because of some requirements in std::vector.
Does someone have other ideas aside from just dropping the const in MyClass?
The text was updated successfully, but these errors were encountered: