Specialization of struct std::hash in different namespace
grigori-gahan opened this issue · 0 comments
grigori-gahan commented
Attempt at specialization of std::hash outside of proper namespace error encountered with examples.
Example being run: https://github.com/zeromq/cppzmq/blob/master/examples/pubsub_multithread_inproc.cpp
CENTOS 7
gcc 4.8.5
In file included from /home/grigori/Desktop/zeromq_test/main.cpp:7:0:
/home/grigori/Desktop/zeromq_test/zmq_addon.hpp:88:25: error: specialization of ‘template struct std::hash’ in different namespace [-fpermissive]
template <> struct std::hashzmq::poller_ref_t
Recommended fix:
enclose this template in namespace std as:
namespace std
{
template <> struct hash<zmq::poller_ref_t>
{
size_t operator()(const zmq::poller_ref_t& ref) const ZMQ_NOTHROW
{
return ref.hash();
}
};
}