nlohmann::to_json method not acting as expected with nlohmann::adl_serializer specialization. #3340
Closed
3 of 5 tasks
Labels
state: needs more info
the author of the issue needs to provide more details
I could not get the
nlohmann::to_json
method to work consistently with specializations of thenlohmann::adl_serializer
which I assumed would work from the way described in the readme.What is the issue you have?
I was using the How do I convert third-party types explanation and I specialized the adl_serializer in the nlohmann namespace with my third party types, Eigen's Vectors and Quaternions, I also did for some of my own types because they were move-constructible only. It sort of works. I would attempt to call
nlohmann::to_json
on my class's toto_json
them. Because that appeared to work. (I looked at the how to make your own serializer for a small amount of guidance on implementing the functions) I did the nlohmann::to_json method because it was intuitive to me but it doesn't compile withnlohmann::to_json(json, Quaternion{})
, things appear to compile when I dojson = Quaternion{}
though so I'm going to use that for now.Please describe the steps to reproduce the issue.
nlohmann::adl_serializer
with some typenlohmann::to_json
on a type defined like this.Can you provide a small but working code example?
This is a repository I set up very quickly to show off the smallest case I had of this occurring. It should be cross platform in terms of files. It's simply a main file that includes your include directory and eigen's include directory.
https://github.com/NovaSmoof/Eigen-nlohmann-conflict
What is the expected behavior?
that I can call nlohmann::to_json after specializing the adl_serializer.
And what is the actual behavior instead?
That I could not.
Which compiler and operating system are you using?
Which version of the library did you use?
I test both. Neither worked for MSVC.
develop
branchI tested with both and it failed with both.
If you experience a compilation error: can you compile and run the unit tests?
I didn't get a compilation error, but my project's settings are really weird and it wouldn't build your unit tests right and your instructions didn't work. I tried it for an hour. And if you would like me to I'd be more than happy to attempt again, but as of right now I can't get many of them to run. I had difficulties downloading the data.
The text was updated successfully, but these errors were encountered: