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
See #590
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.
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).
@jaredgrubb
Thanks. I changed it as suggested.
Most helpful comment
Thanks. I changed the line to this:
This compiles, but dont know if these to lines are equivalent?
The change suggested in the issue linked also compiles for me:
and is closest to the original.