Skip to content
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

A weird building problem :-( #1774

Closed
tanpero opened this issue Oct 4, 2019 · 2 comments
Closed

A weird building problem :-( #1774

tanpero opened this issue Oct 4, 2019 · 2 comments
Labels
kind: question state: needs more info the author of the issue needs to provide more details

Comments

@tanpero
Copy link

tanpero commented Oct 4, 2019

I have a small problem.
I need to keep the insertion order of the JSON keys and output them. According to the existing suggestion, I used nlohmann::fifo_map instead of the original std::map, which is:

using json = nlohmann::basic_json<nlohmann::fifo_map>;

However, when I build, the compiler tells me this error:

add_key: isn't the member of std::less<void>

I guess nlohmann::fifo_map may need its own template parameters, but this depends on the type in the JSON library, so it won't work.
I checked the related issue, but others didn't seem to have encountered this problem. I want to know how this problem should be solved.
My development environment is: Visual Studio 2017
Thanks! :-D

@tanpero
Copy link
Author

tanpero commented Oct 4, 2019

I tried change the code like this: ##1763 (comment)
and it looks like:

template<class K, class V, class dummy_compare, class A>
using my_fifo_map = nlohmann::fifo_map<K, V, nlohmann::fifo_map_compare<K>, A>;
using fifo_json = nlohmann::basic_json<my_fifo_map>;
using json = nlohmann::json;

But it still can't be compiled successfully. The error info is:

undefined identifier: `my_fifo_map`

@tete17
Copy link
Contributor

tete17 commented Oct 6, 2019

@tanpero can you leave a small sample code, that produces the error you are seeing?

Maybe like a small main function?

@nlohmann nlohmann added the state: needs more info the author of the issue needs to provide more details label Oct 17, 2019
@nlohmann nlohmann closed this as completed Nov 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question state: needs more info the author of the issue needs to provide more details
Projects
None yet
Development

No branches or pull requests

3 participants