<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.1" version="1.1">
  <file original="NoName" source-language="en" datatype="plaintext" target-language="zh_Hans">
    <body>
      <trans-unit xml:space="preserve" approved="no" id="bdd77c7545a2ff66" weblate-flags="safe-html, strict-same">
        <source>:idprefix: hash_equality_</source>
        <target state="translated">:idprefix: hash_equality_</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">3</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="5bba697ab5557ff2" weblate-flags="safe-html, strict-same">
        <source>= Equality Predicates and Hash Functions</source>
        <target state="translated">= 相等性谓词与哈希函数</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">5</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="1731fceb4de1f7b2" weblate-flags="safe-html, strict-same">
        <source>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:</source>
        <target state="translated">关联容器使用排序关系来规定元素的存储方式，而无序关联容器则依赖相等性谓词与哈希函数。例如， `xref:reference/unordered_map.adoc[boost::unordered_map]`的声明如下：</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">7</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="d8df052061283cbf" weblate-flags="safe-html, strict-same">
        <source>```cpp template &lt; class Key, class Mapped, class Hash = boost::hash&lt;Key&gt;, class Pred = std::equal_to&lt;Key&gt;, class Alloc = std::allocator&lt;std::pair&lt;Key const, Mapped&gt; &gt; &gt; class unordered_map; ```</source>
        <target state="translated">```cpp template &amp;lt; class Key, class Mapped, class Hash = boost::hash&lt;key&gt;, class Pred = std::equal_to&lt;key&gt;, class Alloc = std::allocator&lt;std::pair&lt;key const,="" mapped=""&gt; &amp;gt; &amp;gt; class unordered_map; ```&lt;/std::pair&lt;key&gt;&lt;/key&gt;&lt;/key&gt;</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">12</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="10006e4136df3f65" weblate-flags="safe-html, strict-same">
        <source>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:</source>
        <target state="translated">哈希函数放在首位，因为你可能只想更改哈希函数而不想更改相等谓词。例如，如果你想使用 https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash[FNV-1a 哈希^]，可以这样写：</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">21</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="d46315c1f943aa7e" weblate-flags="safe-html, strict-same">
        <source>```cpp boost::unordered_map&lt;std::string, int, hash::fnv_1a&gt; dictionary; ```</source>
        <target state="translated">```cpp boost::unordered_map&lt;std::string, int,="" hash::fnv_1a=""&gt; dictionary; ```&lt;/std::string,&gt;</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">25</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="a78723bf0487a483" weblate-flags="safe-html, strict-same">
        <source>There is an link:../../../examples/fnv1.hpp[implementation of FNV-1a^] in the examples directory.</source>
        <target state="translated">examples 目录中有一个链接：../../../examples/fnv1.hpp[implementation of FNV-1a^]</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">30</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="8bc0f514be7114be" weblate-flags="safe-html, strict-same">
        <source>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:</source>
        <target state="translated">```cpp</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">32</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="2bed27f8cd24726f" weblate-flags="safe-html, strict-same">
        <source>```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()); } };</source>
        <target state="translated">```cpp struct iequal_to { bool operator()(std::string const&amp;amp; x, std::string const&amp;amp; y) const { return boost::algorithm::iequals(x, y, std::locale()); } };</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">34</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="5f35e0327e15c444" weblate-flags="safe-html, strict-same">
        <source>struct ihash { std::size_t operator()(std::string const&amp; x) const { std::size_t seed = 0; std::locale locale;</source>
        <target state="translated">struct ihash { std::size_t operator()(std::string const&amp;amp; x) const { std::size_t seed = 0; std::locale locale;</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">44</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="6c5bb9cc291f1ae1" weblate-flags="safe-html, strict-same">
        <source>for(std::string::const_iterator it = x.begin(); it != x.end(); ++it) { boost::hash_combine(seed, std::toupper(*it, locale)); }</source>
        <target state="translated">for(std::string::const_iterator it = x.begin(); it != x.end(); ++it) { boost::hash_combine(seed, std::toupper(*it, locale)); }</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">51</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="1678a687c02dcb17" weblate-flags="safe-html, strict-same">
        <source>return seed; } }; ```</source>
        <target state="translated">return seed; } }; ```</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">57</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="0f117aea1706b9bb" weblate-flags="safe-html, strict-same">
        <source>Which you can then use in a case insensitive dictionary: ```cpp boost::unordered_map&lt;std::string, int, ihash, iequal_to&gt; idictionary; ```</source>
        <target state="translated">然后你可以在不区分大小写的字典中使用它：```cpp boost::unordered_map&lt;std::string, int,="" ihash,="" iequal_to=""&gt; idictionary; ```&lt;/std::string,&gt;</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">62</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="1b3ba8324c209c79" weblate-flags="safe-html, strict-same">
        <source>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.</source>
        <target state="translated">这是 link:../../../examples/case_insensitive.hpp[/libs/unordered/examples/case_insensitive.hpp^] 处示例的简化版本，该示例支持其他区域设置和字符串类型。</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">68</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="d75653525207ed13" weblate-flags="safe-html, strict-same">
        <source>Be careful when using the equality (`==`) operator with custom equality</source>
        <target state="translated">在使用自定义相等谓词时，请谨慎使用相等（==）运算符</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">71</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="7aedaf876f8edc6a" weblate-flags="safe-html, strict-same">
        <source>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.</source>
        <target state="translated">在使用自定义相等谓词（特别是函数指针）时请务必小心。如果你用不同的相等谓词比较两个容器，结果是未定义的。对于大多数无状态函数对象而言，这种情况不可能发生——因为你只能使用相同的相等谓词来比较对象，所以两个相等谓词必然相等。但如果你使用的是函数指针或有状态的相等谓词（例如 boost::function），则可能会遇到问题。</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">72</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="d1e2c103b8b22869" weblate-flags="safe-html, strict-same">
        <source>Custom Types</source>
        <target state="translated">自定义类型</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">79</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="0fdf37a3af3677b3" weblate-flags="safe-html, strict-same">
        <source>Similarly, a custom hash function can be used for custom types:</source>
        <target state="translated">类似地，自定义类型也可使用自定义哈希函数：</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">81</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id=":83" weblate-flags="safe-html, strict-same">
        <source>```cpp struct point { int x; int y; };</source>
        <target state="translated">```cpp struct point { int x; int y; };</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">83</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id=":89" weblate-flags="safe-html, strict-same">
        <source>bool operator==(point const&amp; p1, point const&amp; p2) { return p1.x == p2.x &amp;&amp; p1.y == p2.y; }</source>
        <target state="translated">bool operator==(point const&amp;amp; p1, point const&amp;amp; p2) { return p1.x == p2.x &amp;amp;&amp;amp; p1.y == p2.y; }</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">89</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="c81b67e8661e109d" weblate-flags="safe-html, strict-same">
        <source>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; } };</source>
        <target state="translated">struct point_hash { std::size_t operator()(point const&amp;amp; p) const { std::size_t seed = 0; boost::hash_combine(seed, p.x); boost::hash_combine(seed, p.y); return seed; } };</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">94</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="3ffb87eaece22a65" weblate-flags="safe-html, strict-same">
        <source>boost::unordered_multiset&lt;point, point_hash&gt; points; ```</source>
        <target state="translated">boost::unordered_multiset&lt;point, point_hash=""&gt; points; ```&lt;/point,&gt;</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">105</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="419329157bd37bb5" weblate-flags="safe-html, strict-same">
        <source>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:</source>
        <target state="translated">由于默认哈希函数是 link:../../../../container_hash/index.html[Boost.Hash^]，我们可以扩展它以支持该类型，从而无需显式给出哈希函数：</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">108</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id=":111" weblate-flags="safe-html, strict-same">
        <source>```cpp struct point { int x; int y; };</source>
        <target state="translated">```cpp struct point { int x; int y; };</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">111</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id=":117" weblate-flags="safe-html, strict-same">
        <source>bool operator==(point const&amp; p1, point const&amp; p2) { return p1.x == p2.x &amp;&amp; p1.y == p2.y; }</source>
        <target state="translated">bool operator==(point const&amp;amp; p1, point const&amp;amp; p2) { return p1.x == p2.x &amp;amp;&amp;amp; p1.y == p2.y; }</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">117</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="a60d08d76cdbd7b8" weblate-flags="safe-html, strict-same">
        <source>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; }</source>
        <target state="translated">std::size_t hash_value(point const&amp;amp; p) { std::size_t seed = 0; boost::hash_combine(seed, p.x); boost::hash_combine(seed, p.y); return seed; }</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">122</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="ae85d02a287f0b1c" weblate-flags="safe-html, strict-same">
        <source>boost::unordered_multiset&lt;point&gt; points; ```</source>
        <target state="translated">boost::unordered_multiset&lt;point&gt; points; ```&lt;/point&gt;</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">130</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="6db3a81134214045" weblate-flags="safe-html, strict-same">
        <source>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.</source>
        <target state="translated">有关如何执行此操作的更多详细信息，请参阅 link:../../../../container_hash/index.html[Boost.Hash 文档^]。请记住，它依赖于标准扩展—因此它不适用于无序关联容器的其他实现，你需要显式使用 Boost.Hash。</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">133</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="1c634b847f9b0e3b" weblate-flags="safe-html, strict-same">
        <source>Method</source>
        <target state="translated">方法</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">140</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="f7f5c115cf553484" weblate-flags="safe-html, strict-same">
        <source>Description</source>
        <target state="translated">描述</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">140</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="e8815cf5895783cc" weblate-flags="safe-html, strict-same">
        <source>`hasher hash_function() const`</source>
        <target state="translated">`hasher hash_function() const`</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">140</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="633e151ed0988a20" weblate-flags="safe-html, strict-same">
        <source>Returns the container's hash function.</source>
        <target state="translated">返回容器的哈希函数。</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">140</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="a648fba91d03912d" weblate-flags="safe-html, strict-same">
        <source>`key_equal key_eq() const`</source>
        <target state="translated">`key_equal key_eq() const`</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">140</context>
        </context-group>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="fac0d252cba822a3" weblate-flags="safe-html, strict-same">
        <source>Returns the container's key equality function..</source>
        <target state="translated">返回容器的键相等性函数。</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile"></context>
          <context context-type="linenumber">140</context>
        </context-group>
      </trans-unit>
    </body>
  </file>
</xliff>
