Boost C++ 库

...世界上备受推崇、设计精湛的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu, C++ Coding Standards

函数模板 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 的每一个有界类型都必须满足 Hashable 概念的要求。

效果

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

注意

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

PrevUpHomeNext