Я пытаюсь скомпилировать проект на моем mac, который изначально написан на linux. Он прошел гладко на archlinux, но на Mac много ошибок. Тем более, я очень смущен с этим сообщением об ошибке:Ошибка компиляции Clang на 'std :: hash <unsigned long>
In file included from /Users/STW/Documents/neuroblaze/nb/tagged_index/tagged_index.t.hpp:4:
/Users/STW/Documents/neuroblaze/nb/tagged_index/tagged_index.hpp:425:26: error:
implicit instantiation of undefined template 'std::hash<unsigned long>'
::std::hash<IndexType> hasher;
^
А вот соответствующий код: (tagged_index.hpp)
namespace std {
/**
* tagged_index can be hashed. Just forwards the hash to the contained type.
*
* @ingroup TaggedIndex
*/
template <typename UniquenessTag, typename IndexType,
typename ConstructorFunction>
struct hash<tsb::tagged_index<UniquenessTag, IndexType, ConstructorFunction>> {
using value_type =
tsb::tagged_index<UniquenessTag, IndexType, ConstructorFunction>;
::std::hash<IndexType> hasher;
size_t operator()(const value_type& l) const { return hasher(l); }
};
/**
* tagged_offset can be hashed. Just forwards the hash to the contained type.
*
* @ingroup TaggedOffset
*/
template <typename UniquenessTag, typename IndexType,
typename ConstructorFunction>
struct hash<tsb::tagged_offset<UniquenessTag, IndexType, ConstructorFunction>> {
using value_type =
tsb::tagged_offset<UniquenessTag, IndexType, ConstructorFunction>;
::std::hash<IndexType> hasher;
size_t operator()(const value_type& l) const { return hasher(l); }
};
} // end namespace std
Я включил функционал в этом HPP файл.
Вам не разрешено добавлять материал в 'namespace std'. –
На самом деле это не мой код. И он отлично работает на archlinux. Weird. –
@ н.м. Кроме специализаций шаблонов, таких как [эти] (http://stackoverflow.com/a/8157967/865874). – rodrigo