Boost C++ 库

...世界上最受推崇和设计精良的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu,《C++ 编码规范

函数模板 hash_value - Boost C++ 函数库
PrevUpHomeNext

函数模板 hash_value

boost::hash_value — 为 variant 类型提供哈希运算,以便 boost::hash 可以计算哈希值。

提要

// In header: <boost/variant/variant.hpp>


template<typename T1, typename T2, ..., typename TN> 
  std::size_t hash_value(const variant<T1, T2, ..., TN> & rhs);

描述

要求

variant 的每个有界类型都必须满足 可哈希 概念的要求。

效果

调用 boost::hash<T>()(x),其中 xrhs 的内容,T 是其类型。

注意

实际上,该函数定义在 <boost/variant/detail/hash_variant.hpp> 头文件中。

PrevUpHomeNext