-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Simple ordered_json that works on all supported compilers #2206
Conversation
instead of hard-coding it for std::map's value_type
This is more comprehensive and the "my_workaround_fifo_map" wrapper does not allow to infer value type as required in this branch. This reverts commit 064a9c9.
Almost there. Only missing default template arguments for our new ordered_map... |
Looks like GCC 4.9 on Ubuntu 14 cannot handle the partial template definition required for my current solution. |
When I look at https://travis-ci.org/github/nlohmann/json/builds/700984944, there seem to be a lot of other compilers complaining. I restarted all failed builds, let's see. |
This reverts commit 5fe3d39.
to extract the actual ObjectType::value_type Still fails on older compilers (GCC <= 5.5)
so that it can handle pair<const Key,...>
Using std::map allocator as a placeholder (acd748e) is the most old-compiler friendly way I could find for the recursive declaration of the Allocator. And it is still not working on some compilers. Summarizing:
So I am trying the next alternative: Implement VecMap:erase that works with the same |
Any ideas how proceed here? |
I am quite frustrated about how it fails on GCC 4.9 (quite old anyway) and specially XCode 9.3 (not that old but I have no access to such build system). For the time being we could restrict Fact is, if we cannot make this simple container work, the claim that users can roll their own seems ambitious... However the same applies: a recent compiler is required. |
Fixed for GCC 5.5, which was giving the same error as v4.9 on travis-ci. |
Now it works on all environments. |
@nlohmann this is all yours now... 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments.
Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>
Ops! done now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Thanks a lot!!! |
I opened a new pull request #2258 to bring the feature to the main branch. Thanks so much for your patience and bringing this forward! |
Solved the Allocator issue that prevented using a container whose
value_type
is not the same asstd::map
's.The trick was in instantiating
AllocatorType
withObjectType::value_type
, instead of hard-coding tostd::pair<const Key, basic_json>
. This it stays the same for std::map but adapts to whatever other container we use in other specializations.Pull request checklist
Read the Contribution Guidelines for detailed information.
include/nlohmann
directory, runmake amalgamate
to create the single-header filesingle_include/nlohmann/json.hpp
. The whole process is described here.Please don't
[X] checked too 🙂