mac build fails now
kevinkreiser opened this issue · 1 comments
@patriciogonzalezvivo found that on darwin:
./prime_server/zmq_helpers.hpp:73:45: error: unknown template name '__hash_base'
struct hash<zmq::message_t> : public std::__hash_base<size_t, zmq::message_t> {
^
./prime_server/zmq_helpers.hpp:76:19: error: no member named '_Hash_impl' in namespace 'std'
return std::_Hash_impl::hash(__m.data(), __m.size());
~~~~~^
In file included from src/netstring_protocol.cpp:1:
In file included from ./prime_server/netstring_protocol.hpp:4:
In file included from ./prime_server/prime_server.hpp:18:
./prime_server/zmq_helpers.hpp:73:45: error: unknown template name '__hash_base'
struct hash<zmq::message_t> : public std::__hash_base<size_t, zmq::message_t> {
turns out the issue is that the gnu version of libc++ and whatever the version that comes with xcode clang llvm are completely different:
gnu uses this to hash strings:
https://github.com/gcc-mirror/gcc/blob/1c486c588e0037f4c5645317da3202c6e77ba66c/libstdc%2B%2B-v3/include/bits/basic_string.h#L6031-L6038
and clang llvm in xcode uses:
https://github.com/llvm-mirror/libcxx/blob/apple/include/string#L3882-L3909
of course these implementations are not supposed to be used directly because the specification doesnt dictate how you are to specialize std::hash
for std::string
so we cant rely on either of them being there...
this sucks for a couple of reasons. firstly it means there is no standardized way of hashing bytes even though all implementations of the standard must do so, somehow. second, to make use of the string specialization you MUST have a string and the only way to get a string is copy bytes into it. we really really dont want to copy bytes into the string because there could be rather many of them. so we only have one option left which is to reimplement a _hash_bytes
function..