msgid ""
msgstr ""
"Project-Id-Version: Chinese (Simplified Han script) (Boost Unordered "
"Translation (zh_Hans))\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-06-06 22:48+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Chinese (Simplified Han script) <https://"
"insights.cppalliance.org/weblate/projects/boost-unordered-documentation-"
"zh_Hans/doc-modules-root-pages-hash-equality-adoc/zh_Hans/>\n"
"Language: zh_Hans\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 2026.5\n"

#: :3
#, safe-html, strict-same
msgid ":idprefix: hash_equality_"
msgstr ":idprefix: hash_equality_"

#: :5
#, safe-html, strict-same
msgid "= Equality Predicates and Hash Functions"
msgstr "= 相等性谓词与哈希函数"

#: :7
#, safe-html, strict-same
msgid ""
"While the associative containers use an ordering relation to specify how the "
"elements are stored, the unordered associative containers use an equality "
"predicate and a hash function. For example, `xref:reference/"
"unordered_map.adoc[boost::unordered_map]` is declared as:"
msgstr ""
"关联容器使用排序关系来规定元素的存储方式，而无序关联容器则依赖相等性谓词与哈"
"希函数。例如， `xref:reference/unordered_map.adoc[boost::unordered_map]`的声"
"明如下："

#: :12
#, safe-html, strict-same
msgid ""
"```cpp template < class Key, class Mapped, class Hash = boost::hash<Key>, "
"class Pred = std::equal_to<Key>, class Alloc = std::allocator<std::pair<Key "
"const, Mapped> > > class unordered_map; ```"
msgstr ""
"```cpp template &lt; class Key, class Mapped, class Hash = boost::hash<key>, "
"class Pred = std::equal_to<key>, class Alloc = std::allocator<std::pair<key "
"const,=\"\" mapped=\"\"> &gt; &gt; class unordered_map; ```</std::pair<key></"
"key></key>"

#: :21
#, safe-html, strict-same
msgid ""
"The hash function comes first as you might want to change the hash function "
"but not the equality predicate. For example, if you wanted to use the "
"https://en.wikipedia.org/wiki/"
"Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash[FNV-1a hash^] you "
"could write:"
msgstr ""
"哈希函数放在首位，因为你可能只想更改哈希函数而不想更改相等谓词。例如，如果你"
"想使用 https://en.wikipedia.org/wiki/"
"Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash[FNV-1a 哈希^]，可以"
"这样写："

#: :25
#, safe-html, strict-same
msgid ""
"```cpp boost::unordered_map<std::string, int, hash::fnv_1a> dictionary; ```"
msgstr ""
"```cpp boost::unordered_map<std::string, int,=\"\" hash::fnv_1a=\"\"> "
"dictionary; ```</std::string,>"

#: :30
#, safe-html, strict-same
msgid ""
"There is an link:../../../examples/fnv1.hpp[implementation of FNV-1a^] in "
"the examples directory."
msgstr ""
"examples 目录中有一个链接：../../../examples/fnv1.hpp[implementation of FNV-"
"1a^]"

#: :32
#, safe-html, strict-same
msgid ""
"If you wish to use a different equality function, you will also need to use "
"a matching hash function. For example, to implement a case insensitive "
"dictionary you need to define a case insensitive equality predicate and hash "
"function:"
msgstr "```cpp"

#: :34
#, safe-html, strict-same
msgid ""
"```cpp struct iequal_to { bool operator()(std::string const& x, std::string "
"const& y) const { return boost::algorithm::iequals(x, y, std::locale()); } };"
msgstr ""
"```cpp struct iequal_to { bool operator()(std::string const&amp; x, "
"std::string const&amp; y) const { return boost::algorithm::iequals(x, y, "
"std::locale()); } };"

#: :44
#, safe-html, strict-same
msgid ""
"struct ihash { std::size_t operator()(std::string const& x) const { "
"std::size_t seed = 0; std::locale locale;"
msgstr ""
"struct ihash { std::size_t operator()(std::string const&amp; x) const { "
"std::size_t seed = 0; std::locale locale;"

#: :51
#, safe-html, strict-same
msgid ""
"for(std::string::const_iterator it = x.begin(); it != x.end(); ++it) { "
"boost::hash_combine(seed, std::toupper(*it, locale)); }"
msgstr ""
"for(std::string::const_iterator it = x.begin(); it != x.end(); ++it) { "
"boost::hash_combine(seed, std::toupper(*it, locale)); }"

#: :57
#, safe-html, strict-same
msgid "return seed; } }; ```"
msgstr "return seed; } }; ```"

#: :62
#, safe-html, strict-same
msgid ""
"Which you can then use in a case insensitive dictionary: ```cpp "
"boost::unordered_map<std::string, int, ihash, iequal_to> idictionary; ```"
msgstr ""
"然后你可以在不区分大小写的字典中使用它：```cpp "
"boost::unordered_map<std::string, int,=\"\" ihash,=\"\" iequal_to=\"\"> "
"idictionary; ```</std::string,>"

#: :68
#, safe-html, strict-same
msgid ""
"This is a simplified version of the example at link:../../../examples/"
"case_insensitive.hpp[/libs/unordered/examples/case_insensitive.hpp^] which "
"supports other locales and string types."
msgstr ""
"这是 link:../../../examples/case_insensitive.hpp[/libs/unordered/examples/"
"case_insensitive.hpp^] 处示例的简化版本，该示例支持其他区域设置和字符串类型。"

#: :71
#, safe-html, strict-same
msgid "Be careful when using the equality (`==`) operator with custom equality"
msgstr "在使用自定义相等谓词时，请谨慎使用相等（==）运算符"

#: :72
#, safe-html, strict-same
msgid ""
"predicates, especially if you're using a function pointer. If you compare "
"two containers with different equality predicates then the result is "
"undefined. For most stateless function objects this is impossible - since "
"you can only compare objects with the same equality predicate you know the "
"equality predicates must be equal. But if you're using function pointers or "
"a stateful equality predicate (e.g. `boost::function`) then you can get into "
"trouble."
msgstr ""
"在使用自定义相等谓词（特别是函数指针）时请务必小心。如果你用不同的相等谓词比"
"较两个容器，结果是未定义的。对于大多数无状态函数对象而言，这种情况不可能发生—"
"—因为你只能使用相同的相等谓词来比较对象，所以两个相等谓词必然相等。但如果你使"
"用的是函数指针或有状态的相等谓词（例如 boost::function），则可能会遇到问题。"

#: :79
#, safe-html, strict-same
msgid "Custom Types"
msgstr "自定义类型"

#: :81
#, safe-html, strict-same
msgid "Similarly, a custom hash function can be used for custom types:"
msgstr "类似地，自定义类型也可使用自定义哈希函数："

#: :83
#, safe-html, strict-same
msgctxt ":83"
msgid "```cpp struct point { int x; int y; };"
msgstr "```cpp struct point { int x; int y; };"

#: :89
#, safe-html, strict-same
msgctxt ":89"
msgid ""
"bool operator==(point const& p1, point const& p2) { return p1.x == p2.x && "
"p1.y == p2.y; }"
msgstr ""
"bool operator==(point const&amp; p1, point const&amp; p2) { return p1.x == "
"p2.x &amp;&amp; p1.y == p2.y; }"

#: :94
#, safe-html, strict-same
msgid ""
"struct point_hash { std::size_t operator()(point const& p) const { "
"std::size_t seed = 0; boost::hash_combine(seed, p.x); boost::hash_combine"
"(seed, p.y); return seed; } };"
msgstr ""
"struct point_hash { std::size_t operator()(point const&amp; p) const { "
"std::size_t seed = 0; boost::hash_combine(seed, p.x); boost::hash_combine"
"(seed, p.y); return seed; } };"

#: :105
#, safe-html, strict-same
msgid "boost::unordered_multiset<point, point_hash> points; ```"
msgstr "boost::unordered_multiset<point, point_hash=\"\"> points; ```</point,>"

#: :108
#, safe-html, strict-same
msgid ""
"Since the default hash function is link:../../../../container_hash/"
"index.html[Boost.Hash^], we can extend it to support the type so that the "
"hash function doesn't need to be explicitly given:"
msgstr ""
"由于默认哈希函数是 link:../../../../container_hash/index.html[Boost.Hash^]，"
"我们可以扩展它以支持该类型，从而无需显式给出哈希函数："

#: :111
#, safe-html, strict-same
msgctxt ":111"
msgid "```cpp struct point { int x; int y; };"
msgstr "```cpp struct point { int x; int y; };"

#: :117
#, safe-html, strict-same
msgctxt ":117"
msgid ""
"bool operator==(point const& p1, point const& p2) { return p1.x == p2.x && "
"p1.y == p2.y; }"
msgstr ""
"bool operator==(point const&amp; p1, point const&amp; p2) { return p1.x == "
"p2.x &amp;&amp; p1.y == p2.y; }"

#: :122
#, safe-html, strict-same
msgid ""
"std::size_t hash_value(point const& p) { std::size_t seed = 0; "
"boost::hash_combine(seed, p.x); boost::hash_combine(seed, p.y); return "
"seed; }"
msgstr ""
"std::size_t hash_value(point const&amp; p) { std::size_t seed = 0; "
"boost::hash_combine(seed, p.x); boost::hash_combine(seed, p.y); return "
"seed; }"

#: :130
#, safe-html, strict-same
msgid "boost::unordered_multiset<point> points; ```"
msgstr "boost::unordered_multiset<point> points; ```</point>"

#: :133
#, safe-html, strict-same
msgid ""
"See the link:../../../../container_hash/index.html[Boost.Hash "
"documentation^] for more detail on how to do this. Remember that it relies "
"on extensions to the standard - so it won't work for other implementations "
"of the unordered associative containers, you'll need to explicitly use "
"Boost.Hash."
msgstr ""
"有关如何执行此操作的更多详细信息，请参阅 link:../../../../container_hash/"
"index.html[Boost.Hash 文档^]。请记住，它依赖于标准扩展—因此它不适用于无序关联"
"容器的其他实现，你需要显式使用 Boost.Hash。"

#: :140
#, safe-html, strict-same
msgid "Method"
msgstr "方法"

#: :140
#, safe-html, strict-same
msgid "Description"
msgstr "描述"

#: :140
#, safe-html, strict-same
msgid "`hasher hash_function() const`"
msgstr "`hasher hash_function() const`"

#: :140
#, safe-html, strict-same
msgid "Returns the container's hash function."
msgstr "返回容器的哈希函数。"

#: :140
#, safe-html, strict-same
msgid "`key_equal key_eq() const`"
msgstr "`key_equal key_eq() const`"

#: :140
#, safe-html, strict-same
msgid "Returns the container's key equality function.."
msgstr "返回容器的键相等性函数。"
