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

Compilation error with unordered_map< int, int > #758

Closed
giomasce opened this issue Sep 28, 2017 · 1 comment
Closed

Compilation error with unordered_map< int, int > #758

giomasce opened this issue Sep 28, 2017 · 1 comment

Comments

@giomasce
Copy link

This might be similar to #734, but I observe different results with different plaftorms, so maybe it is a different thing. On Debian unstable with g++ 7.2.0-7 the following program does not compile:

#include <unordered_map>
#include <string>

#include "json.h"

using namespace std;
using json = nlohmann::json;

int main(int argc, char const *argv[])
{
    json j;
    unordered_map< int, int > m;
    m = j.get<decltype(m)>();
}

However, this does work:

#include <unordered_map>
#include <string>

#include "json.h"

using namespace std;
using json = nlohmann::json;

int main(int argc, char const *argv[])
{
    json j;
    unordered_map< string, int > m;
    m = j.get<decltype(m)>();
}

The only change is string instead of int in the unordered_map template arguments. I tried to go through the template error messages, but my C++ knowledge is not sufficiently advanced. The same happens with clang++ 3.8.1-24, again from Debian unstable.

@giomasce
Copy link
Author

Ah, sorry, I guess that integer keys are not allowed in JSON. So this issue is probably invalid, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant