C++ 11 添加于 Boost 1.88.0
分类: 函数对象
一个可扩展的哈希框架。
本次发布
依赖项
Hash2,一个哈希函数库
该库包含一个可扩展的框架,用于实现支持用户定义类型的哈希算法,该框架基于 Howard Hinnant、Vinnie Falco 和 John Bytheway 的论文 "Types don't know #"。
它还包含几种流行哈希算法的实现
哈希算法遵循以下概念
struct HashAlgorithm
{
using result_type = /*integral or array<unsigned char, N>*/; // result type
HashAlgorithm(); // default-constructible
explicit HashAlgorithm( uint64_t seed ); // seed-constructible
HashAlgorithm( void const* seed, size_t n ); // seed-constructible
HashAlgorithm( HashAlgorithm const& r ); // copy-constructible
HashAlgorithm& operator=( HashAlgorithm const& r ); // assignable
void update( void const* data, size_t n ); // feed bytes
result_type result(); // obtain result; also advances state,
// and can be called multiple times
};
有关更多信息,请参阅 文档。
支持的编译器
该库需要 C++11。以下编译器
- g++ 4.8 或更高版本
- clang++ 3.9 或更高版本
- Visual Studio 2015 及更高版本
正在 Github Actions 和 Appveyor 上进行测试。
License
在 Boost 软件许可,1.0 版下分发。