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

json.hpp:6384:62: error: wrong number of template arguments (1, should be 2) #606

Closed
moneroexamples opened this issue Jun 4, 2017 · 4 comments
Labels
solution: duplicate the issue is a duplicate; refer to the linked issue instead

Comments

@moneroexamples
Copy link

After upgrading gcc in majnaro, i started getting this error. Does anyone know to remedy it?

json.hpp: In function ‘bool nlohmann::operator<(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::const_reference, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::const_reference)’:
/home/mwo/onion-monero-blockchain-explorer/src/../ext/json.hpp:6384:62: error: wrong number of template arguments (1, should be 2)
                     return *lhs.m_value.array < *rhs.m_value.array;
                                                              ^~~~~
In file included from /usr/include/c++/7.1.1/tuple:39:0,
                 from /usr/include/c++/7.1.1/bits/unique_ptr.h:37,
                 from /usr/include/c++/7.1.1/memory:80,
                 from /usr/include/boost/config/no_tr1/memory.hpp:21,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:23,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /home/mwo/monero/contrib/epee/include/net/http_client.h:30,
                 from /home/mwo/onion-monero-blockchain-explorer/src/monero_headers.h:21,
                 from /home/mwo/onion-monero-blockchain-explorer/src/MicroCore.h:10,
                 from /home/mwo/onion-monero-blockchain-explorer/src/CurrentBlockchainStatus.h:8,
                 from /home/mwo/onion-monero-blockchain-explorer/src/CurrentBlockchainStatus.cpp:5:
/usr/include/c++/7.1.1/array:94:12: note: provided for ‘template<class _Tp, long unsigned int _Nm> struct std::array’
     struct array
@nlohmann
Copy link
Owner

nlohmann commented Jun 4, 2017

See #590

@nlohmann nlohmann added the solution: duplicate the issue is a duplicate; refer to the linked issue instead label Jun 4, 2017
@nlohmann nlohmann closed this as completed Jun 4, 2017
@moneroexamples
Copy link
Author

moneroexamples commented Jun 4, 2017

Thanks. I changed the line to this:

 //return *lhs.m_value.array < *rhs.m_value.array;
return *lhs.m_value.array.operator<(rhs);

This compiles, but dont know if these to lines are equivalent?

The change suggested in the issue linked also compiles for me:

return (*lhs.m_value.array) < *rhs.m_value.array;

and is closest to the original.

@jaredgrubb
Copy link
Contributor

Changing to "array.operator<" is not equivalent because the array object may not have a member function implementing less-than, it could use a free function in the surrounding namespace, and then this line will fail.

The original was better because it works better with either member-< or free-<.

I would add parens if you really feel like you need to address this (since it's a compiler bug and the code is "fine" as-is).

moneroexamples added a commit to moneroexamples/onion-monero-blockchain-explorer that referenced this issue Jun 5, 2017
@moneroexamples
Copy link
Author

@jaredgrubb

Thanks. I changed it as suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution: duplicate the issue is a duplicate; refer to the linked issue instead
Projects
None yet
Development

No branches or pull requests

3 participants