[boost-doc-zh] r364 committed - 翻译 hash, intrusive, lambda 库的xml/qbk文件

  • From: boost-doc-zh@xxxxxxxxxxxxxx
  • To: boost-doc-zh-notify@xxxxxxxxxxxxx
  • Date: Tue, 12 Jan 2010 07:36:11 +0000

Revision: 364
Author: alai04
Date: Mon Jan 11 23:29:12 2010
Log: 翻译 hash, intrusive, lambda 库的xml/qbk文件
http://code.google.com/p/boost-doc-zh/source/detail?r=364

Added:
 /trunk/doc/src/boost.xml
Modified:
 /trunk/libs/functional/hash/doc/changes.qbk
 /trunk/libs/functional/hash/doc/disable.qbk
 /trunk/libs/functional/hash/doc/intro.qbk
 /trunk/libs/functional/hash/doc/links.qbk
 /trunk/libs/functional/hash/doc/portability.qbk
 /trunk/libs/functional/hash/doc/ref.xml
 /trunk/libs/functional/hash/doc/thanks.qbk
 /trunk/libs/functional/hash/doc/tutorial.qbk
 /trunk/libs/intrusive/doc/intrusive.qbk
 /trunk/libs/lambda/doc/lambda.xml

=======================================
--- /dev/null
+++ /trunk/doc/src/boost.xml    Mon Jan 11 23:29:12 2010
@@ -0,0 +1,771 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE boostbook PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
+  "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd";>
+<boostbook xmlns:xi="http://www.w3.org/2001/XInclude";
+ last-revision="$Date: 2009-10-03 10:30:22 -0400 (Sat, 03 Oct 2009) $">
+  <title>Boost C++库 BoostBook 文档子集</title>
+
+  <preface id="about">
+    <title>本文档中有些什么</title>
+
+ <para>本文档中只是全部 Boost 文档的一个子集:即由 BoostBook 或 QuickBook 源码 + 生成的部分。最终所有 Boost 库都可能会使用这种格式,不过在此之前,许多 Boost
+       文档还不在这里。完整的文档请见 <ulink url="http://www.boost.org/libs";>
+       http://www.boost.org/libs</ulink>。
+    </para>
+
+    <para>
+      在本文档中所列出的一些库还提供了其它格式的文档:
+       <itemizedlist>
+         <listitem>
+ <simpara><ulink url="http://www.boost.org/doc/boost-doc-html.tar.gz";>HTML (tarred, gzipped)</ulink></simpara>
+         </listitem>
+         <listitem>
+ <simpara><ulink url="http://www.boost.org/doc/boost.pdf";>PDF</ulink></simpara>
+         </listitem>
+         <listitem>
+           <simpara>
+ <ulink url="http://www.boost.org/doc/boost-doc-man.tar.gz";>Unix man pages</ulink>
+           </simpara>
+         </listitem>
+         <listitem>
+           <simpara><ulink url="../boost.docbook">DocBook</ulink></simpara>
+         </listitem>
+         <listitem>
+           <simpara>
+             <ulink url="../boost.fo">XSL Formatting Objects</ulink>
+           </simpara>
+         </listitem>
+       </itemizedlist>
+    </para>
+
+  </preface>
+
+  <part id="libraries">
+    <title>Boost C++库 (BoostBook 子集)</title>
+
+    <xi:include href="accumulators.xml"/>
+
+    <xi:include href="../../libs/any/doc/any.xml"/>
+    <xi:include href="../../libs/array/doc/array.xml"/>
+
+   <library name="Asio" dirname="asio" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Christopher</firstname>
+         <surname>Kohlhoff</surname>
+       </author>
+
+ <librarypurpose>Portable networking and other low-level I/O, including sockets, timers, hostname resolution, socket iostreams, serial ports, file descriptors and Windows HANDLEs</librarypurpose>
+       <librarycategory name="category:io"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Bind" dirname="bind" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Peter</firstname>
+         <surname>Dimov</surname>
+       </author>
+ <librarypurpose>Generalized binders for function/object/pointers and member functions</librarypurpose>
+       <librarycategory name="category:higher-order"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Mem_fn" dirname="bind" html-only="1"
+            url="../../libs/bind/mem_fn.html">
+     <libraryinfo>
+       <author>
+         <firstname>Peter</firstname>
+         <surname>Dimov</surname>
+       </author>
+ <librarypurpose>Generalized binders for member functions</librarypurpose>
+       <librarycategory name="category:higher-order"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Call Traits" dirname="call_traits" html-only="1"
+            url="../../libs/utility/call_traits.htm">
+     <libraryinfo>
+       <author>
+         <firstname>John</firstname>
+         <surname>Maddock</surname>
+       </author>
+       <author>
+         <firstname>Howard</firstname>
+         <surname>Hinnant</surname>
+       </author>
+ <librarypurpose>Defines types for passing parameters</librarypurpose>
+       <librarycategory name="category:generic"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Circular Buffer" dirname="circular_buffer" html-only="1"
+            url="../../libs/circular_buffer/index.html">
+     <libraryinfo>
+       <author>
+         <firstname>Jan</firstname>
+         <surname>Gaspar</surname>
+       </author>
+ <librarypurpose>A STL compliant container also known as ring or cyclic buffer</librarypurpose>
+       <librarycategory name="category:containers"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Compatibility" dirname="compatibility" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Ralf</firstname>
+         <surname>Grosse-Kunstleve</surname>
+       </author>
+       <author>
+         <firstname>Jens</firstname>
+         <surname>Maurer</surname>
+       </author>
+ <librarypurpose>Help for non-conforming standard libraries</librarypurpose>
+       <librarycategory name="category:broken"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Compose" dirname="compose" html-only="1"
+            url="../../libs/compose/index.htm">
+     <libraryinfo>
+       <author>
+         <firstname>Nicolai</firstname>
+         <surname>Josuttis</surname>
+       </author>
+
+ <librarypurpose>Functional composition adapters for the STL</librarypurpose>
+       <librarycategory name="category:higher-order"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Compressed Pair" dirname="compressed_pair" html-only="1"
+            url="../../libs/utility/compressed_pair.htm">
+     <libraryinfo>
+       <author>
+         <firstname>John</firstname>
+         <surname>Maddock</surname>
+       </author>
+       <author>
+         <firstname>Howard</firstname>
+         <surname>Hinnant</surname>
+       </author>
+       <librarypurpose>Empty member optimization</librarypurpose>
+       <librarycategory name="category:data-structures"/>
+       <librarycategory name="category:misc"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Concept Check" dirname="concept_check">
+     <libraryinfo>
+       <author>
+         <firstname>Jeremy</firstname>
+         <surname>Siek</surname>
+       </author>
+       <librarypurpose>Tools for generic programming</librarypurpose>
+       <librarycategory name="category:generic"/>
+       <librarycategory name="category:testing"/>
+     </libraryinfo>
+     <title>Boost.Concept_Check</title>
+ <xi:include href="../../libs/concept_check/doc/reference/concepts.xml"/>
+   </library>
+
+   <library name="Config" dirname="config" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>John</firstname>
+         <surname>Maddock</surname>
+       </author>
+       <author>
+         <firstname>Beman</firstname>
+         <surname>Dawes</surname>
+       </author>
+       <author>
+         <firstname>Vesa</firstname>
+         <surname>Karvonen</surname>
+       </author>
+
+ <librarypurpose>Helps boost library developers adapt to compiler idiosyncrasies; not intended for library users</librarypurpose>
+       <librarycategory name="category:broken"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Conversion" dirname="conversion" html-only="1"
+            url="../../libs/conversion/index.html">
+     <libraryinfo>
+       <author>
+         <firstname>Dave</firstname>
+         <surname>Abrahams</surname>
+       </author>
+       <author>
+         <firstname>Kevlin</firstname>
+         <surname>Henney</surname>
+       </author>
+
+ <librarypurpose>Numeric, polymorphic, and lexical casts</librarypurpose>
+       <librarycategory name="category:misc"/>
+     </libraryinfo>
+   </library>
+
+   <library name="CRC" dirname="crc" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Daryle</firstname>
+         <surname>Walker</surname>
+       </author>
+
+       <librarypurpose>Cyclic Redundancy Code</librarypurpose>
+       <librarycategory name="category:misc"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="../../libs/date_time/xmldoc/date_time.xml"/>
+
+   <library name="Dynamic Bitset" dirname="dynamic_bitset" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Jeremy</firstname>
+         <surname>Siek</surname>
+       </author>
+       <author>
+         <firstname>Chuck</firstname>
+         <surname>Allison</surname>
+       </author>
+ <librarypurpose>A runtime sized version of <code>std::bitset</code></librarypurpose>
+       <librarycategory name="category:containers"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Format" dirname="format" html-only="1"
+            url="../../libs/format/index.html">
+     <libraryinfo>
+       <author>
+         <firstname>Samuel</firstname>
+         <surname>Krempp</surname>
+       </author>
+
+ <librarypurpose>Type-safe 'printf-like' format operations</librarypurpose>
+       <librarycategory name="category:string-text"/>
+       <librarycategory name="category:io"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Filesystem" dirname="filesystem" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Beman</firstname>
+         <surname>Dawes</surname>
+       </author>
+
+ <librarypurpose>Portable paths, iteration over directories, and other useful filesystem operations</librarypurpose>
+       <librarycategory name="category:misc"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="foreach.xml"/>
+
+   <xi:include href="../../libs/function/doc/function.xml"/>
+
+   <library name="Functional" dirname="functional" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Mark</firstname>
+         <surname>Rodgers</surname>
+       </author>
+       <librarypurpose>Enhanced function object adaptors</librarypurpose>
+       <librarycategory name="category:higher-order"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="hash.xml"/>
+
+   <library name="Graph" dirname="graph" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Jeremy</firstname>
+         <surname>Siek</surname>
+       </author>
+       <author>
+         <firstname>University of Notre Dame</firstname>
+         <surname>Team</surname>
+       </author>
+ <librarypurpose>Generic graph components and algorithms</librarypurpose>
+       <librarycategory name="category:containers"/>
+       <librarycategory name="category:iterators"/>
+       <librarycategory name="category:algorithms"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Integer" dirname="integer" html-only="1"
+            url="../../libs/integer/index.html">
+     <libraryinfo>
+       <author>
+         <firstname>various</firstname>
+         <surname>authors</surname>
+       </author>
+
+ <librarypurpose>Headers to ease dealing with integral types</librarypurpose>
+       <librarycategory name="category:math"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="interprocess.xml"/>
+
+   <library name="Interval" dirname="numeric/interval" html-only="1"
+            url="../../libs/numeric/interval/doc/index.html">
+     <libraryinfo>
+       <author>
+         <firstname>Guillaume</firstname>
+         <surname>Melquiond</surname>
+       </author>
+       <author>
+         <firstname>Herv&eacute;</firstname>
+         <surname>Br&ouml;nnimann</surname>
+       </author>
+       <author>
+         <firstname>Sylvain</firstname>
+         <surname>Pion</surname>
+       </author>
+
+ <librarypurpose>Extends the usual arithmetic functions to mathematical intervals</librarypurpose>
+       <librarycategory name="category:math"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="intrusive.xml"/>
+
+   <library name="I/O State Savers" dirname="io" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Daryle</firstname>
+         <surname>Walker</surname>
+       </author>
+
+ <librarypurpose>Save I/O state to prevent jumbled data</librarypurpose>
+       <librarycategory name="category:io"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Iterator Adaptors" dirname="utility" html-only="1"
+            url="../../libs/utility/iterator_adaptors.htm">
+     <libraryinfo>
+       <author>
+         <firstname>Dave</firstname>
+         <surname>Abrahams</surname>
+       </author>
+       <author>
+         <firstname>Jeremy</firstname>
+         <surname>Siek</surname>
+       </author>
+       <author>
+         <firstname>John</firstname>
+         <surname>Potter</surname>
+       </author>
+
+ <librarypurpose>Adapt a base type into a standard conforming iterator</librarypurpose>
+       <librarycategory name="category:iterators"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="../../libs/lambda/doc/lambda.xml"/>
+
+   <library name="Math" dirname="math" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>various</firstname>
+         <surname>authors</surname>
+       </author>
+
+ <librarypurpose>Several contributions in the domain of mathematics</librarypurpose>
+       <librarycategory name="category:math"/>
+     </libraryinfo>
+   </library>
+
+ <library name="Math/Common Factor" dirname="math/common_factor" html-only="1"
+            url="../../libs/math/doc/common_factor.html">
+     <libraryinfo>
+       <author>
+         <firstname>Daryle</firstname>
+         <surname>Walker</surname>
+       </author>
+
+ <librarypurpose>Greatest common divisor and least common multiple</librarypurpose>
+       <librarycategory name="category:math"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Math/Octonion" dirname="math/octonion" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Hubert</firstname>
+         <surname>Holin</surname>
+       </author>
+
+       <librarypurpose>Octonions</librarypurpose>
+       <librarycategory name="category:math"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Math/Quaternion" dirname="math/quaternion" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Hubert</firstname>
+         <surname>Holin</surname>
+       </author>
+
+       <librarypurpose>Quaternions</librarypurpose>
+       <librarycategory name="category:math"/>
+     </libraryinfo>
+   </library>
+
+ <library name="Math/Special Functions" dirname="math/special_functions" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Hubert</firstname>
+         <surname>Holin</surname>
+       </author>
+
+ <librarypurpose>Mathematical special functions such as atanh, sinc, and sinhc</librarypurpose>
+       <librarycategory name="category:math"/>
+     </libraryinfo>
+   </library>
+
+   <library name="MPL" dirname="mpl" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Aleksey</firstname>
+         <surname>Gurtovoy</surname>
+       </author>
+
+ <librarypurpose>Template metaprogramming framework of compile-time algorithms, sequences and metafunction classes</librarypurpose>
+       <librarycategory name="category:template"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Multi Array" dirname="multi_array" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Ron</firstname>
+         <surname>Garcia</surname>
+       </author>
+
+ <librarypurpose>Multidimensional containers and adaptors for arrays of contiguous data</librarypurpose>
+       <librarycategory name="category:math"/>
+       <librarycategory name="category:containers"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Operators" dirname="utility" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Dave</firstname>
+         <surname>Abrahams</surname>
+       </author>
+       <author>
+         <firstname>Jeremy</firstname>
+         <surname>Siek</surname>
+       </author>
+
+ <librarypurpose>Templates ease arithmetic classes and iterators</librarypurpose>
+       <librarycategory name="category:generic"/>
+       <librarycategory name="category:iterators"/>
+       <librarycategory name="category:math"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Optional" dirname="optional" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Fernando</firstname>
+         <surname>Cacciola</surname>
+       </author>
+
+ <librarypurpose>Discriminated-union wrapper for optional values</librarypurpose>
+       <librarycategory name="category:misc"/>
+       <librarycategory name="category:data-structures"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="mpi.xml"/>
+
+   <library name="Pool" dirname="pool" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Steve</firstname>
+         <surname>Cleary</surname>
+       </author>
+
+       <librarypurpose>Memory pool management</librarypurpose>
+       <librarycategory name="category:memory"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Preprocessor" dirname="preprocessor" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Vesa</firstname>
+         <surname>Karvonen</surname>
+       </author>
+       <author>
+         <firstname>Paul</firstname>
+         <surname>Mensonides</surname>
+       </author>
+
+ <librarypurpose>Preprocessor metaprogramming tools including repetition and recursion</librarypurpose>
+       <librarycategory name="category:preprocessor"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="../../libs/program_options/doc/program_options.xml"/>
+
+   <library name="Property Map" dirname="property_map" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Jeremy</firstname>
+         <surname>Siek</surname>
+       </author>
+ <librarypurpose>Concepts defining interfaces which map key objects to value objects</librarypurpose>
+       <librarycategory name="category:containers"/>
+       <librarycategory name="category:generic"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="property_tree.xml"/>
+
+   <xi:include href="proto.xml"/>
+
+   <library name="Python" dirname="python" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Dave</firstname>
+         <surname>Abrahams</surname>
+       </author>
+ <librarypurpose>Reflects C++ classes and functions into <ulink url="http://www.python.org";>Python</ulink></librarypurpose>
+       <librarycategory name="category:lang"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Random" dirname="random" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Jens</firstname>
+         <surname>Maurer</surname>
+       </author>
+ <librarypurpose>A complete system for random number generation</librarypurpose>
+       <librarycategory name="category:math"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Rational" dirname="rational" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Paul</firstname>
+         <surname>Moore</surname>
+       </author>
+       <librarypurpose>A rational number class</librarypurpose>
+       <librarycategory name="category:math"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="../../libs/bind/doc/ref.xml"/>
+
+   <library name="Regex" dirname="regex" html-only="1"
+            url="../../libs/regex/index.html">
+     <libraryinfo>
+       <author>
+         <firstname>John</firstname>
+         <surname>Maddock</surname>
+       </author>
+       <librarypurpose>Regular expression library</librarypurpose>
+       <librarycategory name="category:string-text"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Serialization" dirname="serialization" html-only="1"
+            url="../../libs/serialization/index.html">
+     <libraryinfo>
+       <author>
+         <firstname>Robert</firstname>
+         <surname>Ramey</surname>
+       </author>
+ <librarypurpose>Serialization of C++ objects for persistence and marshalling</librarypurpose>
+       <librarycategory name="category:io"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="../../libs/signals/doc/signals.xml"/>
+
+   <xi:include href="../../libs/signals2/doc/signals.xml"/>
+
+   <library name="Smart Pointer" dirname="smart_ptr" html-only="1"
+            url="../../libs/smart_ptr/index.html">
+     <libraryinfo>
+       <author>
+         <firstname>Greg</firstname>
+         <surname>Colvin</surname>
+       </author>
+       <author>
+         <firstname>Beman</firstname>
+         <surname>Dawes</surname>
+       </author>
+       <author>
+         <firstname>Peter</firstname>
+         <surname>Dimov</surname>
+       </author>
+       <author>
+         <firstname>Darin</firstname>
+         <surname>Adler</surname>
+       </author>
+       <librarypurpose>Five smart pointer class templates</librarypurpose>
+       <librarycategory name="category:memory"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Spirit" dirname="spirit" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Joel</firstname>
+         <surname>de Guzman</surname>
+       </author>
+       <author>
+         <firstname>team</firstname>
+       </author>
+
+ <librarypurpose>LL parser framework represents parsers directly as EBNF grammars in inlined C++</librarypurpose>
+       <librarycategory name="category:text"/>
+       <librarycategory name="category:parsing"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="static_assert.xml"/>
+
+   <xi:include href="../../libs/algorithm/string/doc/string_algo.xml"/>
+
+   <library name="Test" dirname="test" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Gennadiy</firstname>
+         <surname>Rozental</surname>
+       </author>
+ <librarypurpose>Support for simple program testing, full unit testing, and for program execution monitoring</librarypurpose>
+       <librarycategory name="category:testing"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="thread.xml"/>
+
+   <library name="Timer" dirname="timer" html-only="1"
+            url="../../libs/timer/index.html">
+     <libraryinfo>
+       <author>
+         <firstname>Beman</firstname>
+         <surname>Dawes</surname>
+       </author>
+ <librarypurpose>Event timer, progress timer, and progress display classes</librarypurpose>
+       <librarycategory name="category:misc"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Tokenizer" dirname="tokenizer" html-only="1"
+            url="../../libs/tokenizer/index.html">
+     <libraryinfo>
+       <author>
+         <firstname>John</firstname>
+         <surname>Bandela</surname>
+       </author>
+ <librarypurpose>Break of a string or other character sequence into a series of tokens</librarypurpose>
+       <librarycategory name="category:string-text"/>
+       <librarycategory name="category:iterators"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="tr1.xml"/>
+   <xi:include href="../../libs/logic/doc/tribool.boostbook"/>
+
+   <library name="Tuple" dirname="tuple" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Jaakko</firstname>
+         <surname>J&auml;rvi</surname>
+       </author>
+ <librarypurpose>Ease definition of functions returning multiple values, and more</librarypurpose>
+       <librarycategory name="category:data-structures"/>
+     </libraryinfo>
+   </library>
+
+   <library name="Type Traits" dirname="type_traits" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>John</firstname>
+         <surname>Maddock</surname>
+       </author>
+       <librarypurpose>Meta-programming support library.</librarypurpose>
+       <librarycategory name="category:generic"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="typeof.xml"/>
+
+   <library name="uBLAS" dirname="numeric/ublas" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Joerg</firstname>
+         <surname>Walter</surname>
+       </author>
+       <author>
+         <firstname>Mathias</firstname>
+         <surname>Koch</surname>
+       </author>
+ <librarypurpose>Basic linear algebra for dense, packed and sparse matrices</librarypurpose>
+       <librarycategory name="category:math"/>
+     </libraryinfo>
+   </library>
+
+   <xi:include href="units.xml"/>
+
+   <xi:include href="unordered.xml"/>
+
+   <library name="Utility" dirname="utility" html-only="1">
+     <libraryinfo>
+       <author>
+         <firstname>Dave</firstname>
+         <surname>Abrahams</surname>
+       </author>
+       <author>
+         <firstname>others</firstname>
+       </author>
+
+ <librarypurpose>Class noncopyable plus <functionname>checked_delete</functionname>, <functionname>checked_array_delete</functionname>, <functionname>next</functionname>, <functionname>prior</functionname> function templates, plus base-from-member idiom</librarypurpose>
+       <librarycategory name="category:misc"/>
+       <librarycategory name="category:memory"/>
+       <librarycategory name="category:algorithms"/>
+     </libraryinfo>
+   </library>
+   <xi:include href="../../libs/variant/doc/variant.xml"/>
+
+   <xi:include href="xpressive.xml"/>
+
+  </part>
+
+  <part id="tools">
+    <title>Boost 工具</title>
+    <partintro>
+      <para>
+ Boost 的开发人员、测试人员和维护人员开发了多个程序来协助管理 Boost 库。
+               与 Boost 的其它所有东西一样,这些工具也是以源程序方式提供,也是正规的
+               Boost 分发包中的一部分。
+      </para>
+      <para>
+ 用户在将 Boost 库移植到新的平台或将 Boost 库用于自己的应用程序 时,会发现
+               这些工具非常有用。
+      </para>
+    </partintro>
+    <xi:include href="../../tools/boostbook/doc/boostbook.xml"/>
+    <xi:include href="quickbook.xml"/>
+    <xi:include href="bjam.xml"/>
+    <xi:include href="../../tools/build/v2/doc/src/userman.xml"/>
+  </part>
+</boostbook>
+
+
=======================================
--- /trunk/libs/functional/hash/doc/changes.qbk Mon Dec 28 23:05:14 2009
+++ /trunk/libs/functional/hash/doc/changes.qbk Mon Jan 11 23:29:12 2010
@@ -3,91 +3,127 @@
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
  / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]

-[section:changes Change Log]
+[section:changes Change Log 变更日志]

 [h2 Boost 1.33.0]

-* Initial Release
+* Initial Release\n
+  最初版本

 [h2 Boost 1.33.1]

-* Fixed the points example, as pointed out by 沈慧峰.
+* Fixed the points example, as pointed out by 沈慧峰.\n
+  修复由沈慧峰指出的指针实例。

 [h2 Boost 1.34.0]

 * Use declarations for standard classes, so that the library
-  doesn't need to include all of their headers
+  doesn't need to include all of their headers\n
+  为标准类使用声明,以便库不再需要包含所有的头文件。
* Deprecated the `<boost/functional/hash/*.hpp>` headers. Now a single header,
-  <[headerref boost/functional/hash.hpp]> is used.
+  <[headerref boost/functional/hash.hpp]> is used.\n
+ 不赞成使用 `<boost/functional/hash/*.hpp>` 头文件。使用单独的头文件 <[headerref boost/functional/hash.hpp]>。
 * Add support for the `BOOST_HASH_NO_EXTENSIONS` macro, which
-  disables the extensions to TR1.
-
-* Minor improvements to the hash functions for floating point numbers.
-* Update the portable example to hopefully be more generally portable.
+  disables the extensions to TR1.\n
+  增加对 `BOOST_HASH_NO_EXTENSIONS` 宏的支持,它可以使对 TR1 的扩展无效。
+* Minor improvements to the hash functions for floating point numbers.\n
+  浮点数的散列函数的小幅度改进。
+* Update the portable example to hopefully be more generally portable.\n
+  更新可移植的示例,但愿能更广泛地一致。

 [h2 Boost 1.34.1]

 * [@http://svn.boost.org/trac/boost/ticket/952 Ticket 952]:
-  Suppress incorrect 64-bit warning on Visual C++.
+  Suppress incorrect 64-bit warning on Visual C++.\n
+ [@http://svn.boost.org/trac/boost/ticket/952 Ticket 952]:消除 Visaul C++ 上不正确的 64 位警告。

 [h2 Boost 1.35.0]

-* Support for `long long`, `std::complex`.
-* Improved algorithm for hashing floating point numbers:
+* Support for `long long`, `std::complex`.\n
+  为 `long long`, `std::complex` 提供支持。
+* Improved algorithm for hashing floating point numbers:\n
+  改进散列浮点数的算法:
   * Improved portablity, as described by Daniel Krügler in
     [@http://lists.boost.org/boost-users/2005/08/13418.php
-    a post to the boost users list].
+    a post to the boost users list].\n
+ 改进可移植性,就像 Daniel Krügler 在 [@http://lists.boost.org/boost-users/2005/08/13418.php
+    给boost用户列表的一篇帖子] 中描述的一样。
   * Fits more information into each combine loop, which can reduce the
     the number of times combine is called and hopefully give a better
-    quality hash function.
-  * Improved the algorithm for hashing floating point numbers.
+    quality hash function.\n
+ 在每次结合循环中装入更多信息,这样就能减少调用结合的次数并有望得到一个 品质更好的散列函数。
+  * Improved the algorithm for hashing floating point numbers.\n
+    改进散列浮点数的算法。
   * On Cygwin use a binary hash function for floating point numbers, as
-    Cygwin doesn't have decent floating point functions for `long double`.
-  * Never uses `fpclass` which doesn't support `long double`.
+ Cygwin doesn't have decent floating point functions for `long double`.\n + 在 Cygwin 中为浮点数使用一个二元的散列函数,因为 Cygwin 没有适宜的针对 `long double` 的浮点机能。
+  * Never uses `fpclass` which doesn't support `long double`.\n
+    不再使用不支持 `long double` 的 `fpclass`。
   * [@http://svn.boost.org/trac/boost/ticket/1064 Ticket 1064]:
-    Removed unnecessary use of `errno`.
-* Explicitly overload for more built in types.
-* Minor improvements to the documentation.
-* A few bug and warning fixes:
-  * [@http://svn.boost.org/trac/boost/ticket/1509 Ticket 1509]:
+    Removed unnecessary use of `errno`.\n
+ [@http://svn.boost.org/trac/boost/ticket/1064 Ticket 1064]:移除了不必 要的 `errno` 的使用。
+* Explicitly overload for more built in types.\n
+  针对更多内建类型的显示重载。
+* Minor improvements to the documentation.\n
+  文档中的小规模改进。
+* A few bug and warning fixes:\n
+  修改少数 bug 和警告:
+  * [@http://svn.boost.org/trac/boost/ticket/1509 Ticket 1509]:\n
     Suppress another Visual C++ warning.
-  * Some workarounds for the Sun compilers.
+ [@http://svn.boost.org/trac/boost/ticket/1509 Ticket 1509]:消除其它 Visual C++ 警告。
+  * Some workarounds for the Sun compilers.\n
+    针对 Sun 编译器的一些 workarounds。

 [h2 Boost 1.36.0]

-* Stop using OpenBSD's dodgy `std::numeric_limits`.
-* Using the boost typedefs for `long long` and `unsigned long long`.
-* Move the extensions into their own header.
+* Stop using OpenBSD's dodgy `std::numeric_limits`.\n
+  停止使用 OpenBSD 的不可靠的 `std::numeric_limits`。
+* Using the boost typedefs for `long long` and `unsigned long long`.\n
+  为 `long long` 和 `unsigned long long` 使用 boost typedefs。
+* Move the extensions into their own header.\n
+  将扩展移入它们自己的头文件。

 [h2 Boost 1.37.0]

 * [@http://svn.boost.org/trac/boost/ticket/2264 Ticket 2264]:
In Visual C++, always use C99 float functions for `long double` and `float` as
-  the C++ overloads aren't always availables.
+  the C++ overloads aren't always availables.\n
+ [@http://svn.boost.org/trac/boost/ticket/2264 Ticket 2264]: 在 Visual C++ 中, + 对于 `long double` 和 `float` 总是使用C99浮点函数,因为C++重载不总是可用 的。

 [h2 Boost 1.38.0]

* Changed the warnings in the deprecated headers from 1.34.0 to errors. These
-  will be removed in a future version of Boost.
+  will be removed in a future version of Boost.\n
+ 将1.34.0起不再使用的头文件,由告警改为错误。在未来的Boost版本中,这些头文 件将被去掉。 * Moved detail headers out of `boost/functional/detail`, since they are part of functional/hash, not functional. `boost/functional/detail/container_fwd.hpp` has been moved to `boost/detail/container_fwd.hpp` as it's used outside of - this library, the others have been moved to `boost/functional/hash/detail`. + this library, the others have been moved to `boost/functional/hash/detail`.\n + 将实现细节的头文件移出 `boost/functional/detail`,因为它们是 functional/hash 而不是 functional 的一部分。 + `boost/functional/detail/container_fwd.hpp` 被移至 `boost/detail/container_fwd.hpp`,
+  由于它在本库之外使用,其它文件则被移至 `boost/functional/hash/detail`.

 [h2 Boost 1.39.0]

* Move the hash_fwd.hpp implementation into the hash subdirectory, leaving a forwarding header in the old location. You should still use the old location, - the new location is mainly for implementation and possible modularization. + the new location is mainly for implementation and possible modularization.\n
+  将 hash_fwd.hpp 的实现移至 hash 子目录,在原目录处保留一个前向头文件。
+  你应该仍旧使用原目录,新的目录主要用于实现,并有可能会变动。
* [@https://svn.boost.org/trac/boost/ticket/2412 Ticket 2412]: Removed deprecated
-  headers.
+  headers.\n
+ [@https://svn.boost.org/trac/boost/ticket/2412 Ticket 2412]: 移除不再使用 的头文件。 * [@https://svn.boost.org/trac/boost/ticket/2957 Ticket 2957]: Fix configuration
-  for vxworks.
+  for vxworks.\n
+ [@https://svn.boost.org/trac/boost/ticket/2957 Ticket 2957]: 修正用于 vxworks 的配置。

 [h2 Boost 1.40.0]

* Automatically configure the float functions using template metaprogramming
-  instead of trying to configure every possibility manually.
-* Workaround for when STLport doesn't support long double.
+  instead of trying to configure every possibility manually.\n
+  使用模板元编程来完成浮点函数的自动配置,代替原先手工尝试配置各种可能性。
+* Workaround for when STLport doesn't support long double.\n
+  当 STLport 不支持 long double 时的变通方法。

 [endsect]
=======================================
--- /trunk/libs/functional/hash/doc/disable.qbk Mon Dec 28 23:05:14 2009
+++ /trunk/libs/functional/hash/doc/disable.qbk Mon Jan 11 23:29:12 2010
@@ -3,7 +3,7 @@
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
  / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]

-[section:disable Disabling The Extensions]
+[section:disable Disabling The Extensions 使扩展无效]

While [classref boost::hash]'s extensions are generally useful, you might want
 to turn them of in order to check that your code will work with other
@@ -11,19 +11,28 @@
 When this macro is defined, only the specialisations detailed
 in TR1 will be declared. But, if you later undefine the macro and include
<[headerref boost/functional/hash.hpp]> then the non-specialised form will be defined
-- activating the extensions.
+- activating the extensions.\n
+虽然 [classref boost::hash] 的扩展通常是有用的,但为了检查你的代码是否可以 和 TR1 的其它实现一起工作, +你有可能想将它们关掉。要做到这一点,请定义这个宏 `BOOST_HASH_NO_EXTENSIONS`。当这个宏被定义的时候,
+只有在 TR1 中列举的特化才被声明。但是,如果你随后取消这个宏定义并包含
+<[headerref boost/functional/hash.hpp]>,非特化形式就会被定义 —— 激活了扩 展。

It is strongly recommended that you never undefine the macro - and only define it so that it applies to the complete translation unit, either by defining it at the beginning of the main source file or, preferably, by using a compiler -switch or preference. And you really should never define it in header files. +switch or preference. And you really should never define it in header files.\n +强烈推荐你永远不要取消这个宏定义 —— 仅仅定义它以便它应用于整个编译单元,你 可以在主程序文件的开始定义它, +更好的做法时,使用一个编译开关或首选项。还有,你绝对不应该在头文件中定义 它。

If you are writing a library which has code in the header which requires the
 extensions, then the best action is to tell users not to define the macro.
-Their code won't ['require] the macro.
+Their code won't ['require] the macro.\n
+如果你编写一个库,有些头文件中的代码需要这些扩展,最好的做法就是告诉用户不 要定义这个宏。
+它们的代码不会 ['需要] 这个宏。

Translation units that are compiled with the macro defined will link with units
 that were compiled without it. This feature has been designed to avoid ODR
-violations.
+violations.\n
+带着这个宏定义编译的翻译单元可以和不带它编译的翻译单元连接。设计这个特性是 为了避免 ODR 违反。

 [endsect]
=======================================
--- /trunk/libs/functional/hash/doc/intro.qbk   Mon Dec 28 23:05:14 2009
+++ /trunk/libs/functional/hash/doc/intro.qbk   Mon Jan 11 23:29:12 2010
@@ -3,7 +3,7 @@
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
  / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]

-[section:intro Introduction]
+[section:intro Introduction 简介]

 [def __tr1-full__
     [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf
@@ -27,22 +27,28 @@
 [classref boost::hash] is an implementation of the __hash-function__ object
 specified by the __tr1-full__ (TR1). It is the default hash function for
 __unordered__, __intrusive__'s unordered associative containers, and
-__multi-index-short__'s hash indicies and __bimap__'s `unordered_set_of`.
-
-As it is compliant with __tr1__, it will work with:
-
-* integers
-* floats
-* pointers
-* strings
+__multi-index-short__'s hash indicies and __bimap__'s `unordered_set_of`.\n
+[classref boost::hash] 是 __tr1-full__ (TR1) 规范的 __hash-function__ 对象 的一个实现。 +它是 __unordered__, __intrusive__ 的无序关联式容器,__multi-index-short__ 的散列索引,
+以及 __bimap__ 的 `unordered_set_of` 的缺省散列函数。
+
+As it is compliant with __tr1__, it will work with:\n
+因为它遵循 __tr1__,所以它可以和以下类型一起工作:
+
+* integers 整数
+* floats 浮点数
+* pointers 指针
+* strings 字符串

It also implements the extension proposed by Peter Dimov in issue 6.18 of the
-__issues__ (page 63), this adds support for:
-
-* arrays
+__issues__ (page 63), this adds support for:\n
+它也实现了 Peter Dimov 在 __issues__(第 63 页)中的 issue 6.18 提议的扩 展,
+这就提供了对以下各项的支持:
+
+* arrays 数组
 * `std::pair`
-* the standard containers.
-* extending [classref boost::hash] for custom types.
+* the standard containers. 标准容器
+* extending [classref boost::hash] for custom types. 为定制类型扩展 [classref boost::hash]

 [endsect]

=======================================
--- /trunk/libs/functional/hash/doc/links.qbk   Mon Dec 28 23:05:14 2009
+++ /trunk/libs/functional/hash/doc/links.qbk   Mon Jan 11 23:29:12 2010
@@ -3,25 +3,29 @@
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
  / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]

-[section:links Links]
+[section:links Links 链接]

 [*A Proposal to Add Hash Tables to the Standard Library]
 [@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1456.html]
The hash table proposal explains much of the design. The hash function object
-is discussed in Section D.
+is discussed in Section D.\n
+这个散列表建议书解释了本库的许多设计。散列函数对象在D节中讨论。

 [*The C++ Standard Library Technical Report.]
 [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf]
-Contains the hash function specification in section 6.3.2.
+Contains the hash function specification in section 6.3.2.\n
+包含了在第6.3.2节中给出的散列函数。

 [*Library Extension Technical Report Issues List.]
 [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf]
-The library implements the extension described in Issue 6.18, pages 63-67.
+The library implements the extension described in Issue 6.18, pages 63-67.\n
+本库实现了在 Issue 6.18, 第63-67页 中描述的扩展。

 [*Methods for Identifying Versioned and Plagiarised Documents]
 Timothy C. Hoad, Justin Zobel
 [@http://www.cs.rmit.edu.au/~jz/fulltext/jasist-tch.pdf]
-Contains the hash function that [funcref boost::hash_combine] is based on.
+Contains the hash function that [funcref boost::hash_combine] is based on.\n
+包含了 [funcref boost::hash_combine] 所基于的散列函数。

 [endsect]

=======================================
--- /trunk/libs/functional/hash/doc/portability.qbk     Mon Dec 28 23:05:14 2009
+++ /trunk/libs/functional/hash/doc/portability.qbk     Mon Jan 11 23:29:12 2010
@@ -3,21 +3,26 @@
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
  / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]

-[section:portability Portability]
+[section:portability Portability 可移植性]

 [def __boost_hash__ [classref boost::hash]]

__boost_hash__ is written to be as portable as possible, but unfortunately, several older compilers don't support argument dependent lookup (ADL) - the mechanism used for customisation. On those compilers custom overloads for `hash_value`
-needs to be declared in the boost namespace.
+needs to be declared in the boost namespace.\n
+__boost_hash__ 尽可能按照可移植的要求写成,但是,不幸的是,若干早期版本的编 译器不支持实参依赖查找(ADL) +—— 用于定制化的机制。在这些编译器上,定制化重载 `hash_value` 需要声明在 boost 名字空间中。

 On a strictly standards compliant compiler, an overload defined in the
 boost namespace won't be found when __boost_hash__ is instantiated,
 so for these compilers the overload should only be declared in the same
-namespace as the class.
-
-Let's say we have a simple custom type:
+namespace as the class.\n
+在一个严格符合标准的编译器上,当 __boost_hash__ 被实例化时,定义在 boost 名 字空间中的重载不会被找到,
+所以在这些编译器上重载和类应该声明在同一个名字空间中。
+
+Let's say we have a simple custom type:\n
+假设我们有一个简单的定制类型:

     namespace foo
     {
@@ -40,9 +45,13 @@
 it will look at the namespace inside the type and find `hash_value`
 but on a compiler which doesn't support ADL `hash_value` won't be found.
 To make things worse, some compilers which do support ADL won't find
-a friend class defined inside the class.
-
-So first move the member function out of the class:
+a friend class defined inside the class.\n
+在一个符合标准的编译器上,当这个类型调用 `hash_value` 时,它会查找这个类型 内部的名字空间并找到 +`hash_value`,但是在不支持 ADL 的编译器上则找不到 `hash_value`。让事情变得 更糟糕的是,
+有些支持 ADL 的编译器不会发现定义在类内部的友元类。
+
+So first move the member function out of the class:\n
+所以,首先要将这个成员函数移出这个类:

     namespace foo
     {
@@ -69,10 +78,13 @@

 Unfortunately, I couldn't declare hash_value as a friend, as some compilers
 don't support template friends, so instead I declared a member function to
-calculate the hash, and called it from hash_value.
+calculate the hash, and called it from hash_value.\n
+不幸的是,因为有些编译器不支持模板友元,我不能将 hash_value 声明为友元,
+所以我声明了一个成员函数来计算散列,再从 hash_value 中调用它。

For compilers which don't support ADL, hash_value needs to be defined in the
-boost namespace:
+boost namespace:\n
+对于不支持 ADL 的编译器,hash_value 要定义在 boost 名字空间中:

     #ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
     namespace boost
@@ -88,18 +100,24 @@
     }

 Full code for this example is at
-[@boost:/libs/functional/hash/examples/portable.cpp /libs/functional/hash/examples/portable.cpp].
-
-[h2 Other Issues]
+[@boost:/libs/functional/hash/examples/portable.cpp /libs/functional/hash/examples/portable.cpp].\n +这个例子的完整代码在 [@boost:/libs/functional/hash/examples/portable.cpp /libs/functional/hash/examples/portable.cpp].
+
+[h2 Other Issues 其它问题]

On Visual C++ versions 6.5 and 7.0, `hash_value` isn't overloaded for built in arrays. __boost_hash__, [funcref boost::hash_combine] and [funcref boost::hash_range] all use a workaround to
-support built in arrays so this shouldn't be a problem in most cases.
-
-On Visual C++ versions 6.5 and 7.0, function pointers aren't currently supported.
+support built in arrays so this shouldn't be a problem in most cases.\n
+在 Visual C++ 版本 6.5 和 7.0 中,`hash_value` 没有为内建数组重载。 __boost_hash__, [funcref boost::hash_combine] +和 [funcref boost::hash_range] 都使用一个变通的方法来支持内建数组,所以在大 多数情况下,这不再是个问题。
+
+On Visual C++ versions 6.5 and 7.0, function pointers aren't currently supported.\n
+在 Visual C++ 版本 6.5 和 7.0 中,函数指针没有被正确地支持。

 When using GCC on Solaris, `boost::hash_value(long double)` treats
`long double`s as `double`s - so the hash function doesn't take into account the
-full range of values.
+full range of values.\n
+在 Solaris 上使用 GCC 时,`boost::hash_value(long double)` 将 `long double`s 当做 `double`s 处理
+—— 所以散列函数不会考虑整个值域空间。

 [endsect]
=======================================
--- /trunk/libs/functional/hash/doc/ref.xml     Mon Dec 28 23:05:14 2009
+++ /trunk/libs/functional/hash/doc/ref.xml     Mon Jan 11 23:29:12 2010
@@ -10,13 +10,18 @@
     <para>For the full specification, see section 6.3 of the
<ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf";>C++ Standard Library Technical Report</ulink>
         and issue 6.18 of the
- <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf";>Library Extension Technical Report Issues List</ulink> (page 63). + <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf";>Library Extension Technical Report Issues List</ulink> (page 63).<sbr/> + 完整的规范请参见 <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf";>
+        C++ Standard Library Technical Report</ulink> 第6.3节和
+ <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf";> + Library Extension Technical Report Issues List</ulink> issue 6.18 (第63页)。
     </para>
   </section>
   <header name="boost/functional/hash.hpp">
     <para>
       Defines <code><classname>boost::hash</classname></code>,
-      and helper functions.
+      and helper functions.<sbr/>
+      定义 <code><classname>boost::hash</classname></code>,以及辅助函数。
     </para>

     <namespace name="boost">
@@ -34,7 +39,8 @@
           <classname>std::unary_function&lt;T, std::size_t&gt;</classname>
         </inherit>

- <purpose><simpara>A <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf";>TR1</ulink> compliant hash function object.</simpara></purpose> + <purpose><simpara>A <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf";>TR1</ulink> compliant hash function object.<sbr/> + 一个遵循 <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf";>TR1</ulink> 的散列函数对象。</simpara></purpose>

         <method name="operator()" cv="const">
           <type>std::size_t</type>
@@ -48,17 +54,22 @@
             <para>
The call to <code><functionname>hash_value</functionname></code>
               is unqualified, so that custom overloads can be
-              found via argument dependent lookup.
+              found via argument dependent lookup.<sbr/>
+ 对 <code><functionname>hash_value</functionname></code> 的调 用是没有限定的,
+              以便通过参数依赖查找能找到定制重载。
             </para>
             <para>
This is not defined when the macro <code>BOOST_HASH_NO_EXTENSIONS</code> is defined. The specializations are still defined, so only the specializations
-              required by TR1 are defined.
+              required by TR1 are defined.<sbr/>
+ 如果宏 <code>BOOST_HASH_NO_EXTENSIONS</code> 被定义,这个就没 有被定义。
+              但特化依然被定义,所以只有被 TR1 所需要的特化被定义。
             </para>
           </notes>
           <throws><para>
             Only throws if
-            <code><functionname>hash_value</functionname>(T)</code> throws.
+ <code><functionname>hash_value</functionname>(T)</code> throws.<sbr/> + 只有 <code><functionname>hash_value</functionname>(T)</code> 抛 出时,才会抛出。
           </para></throws>
         </method>
       </struct>
@@ -74,10 +85,12 @@
             <paramtype>bool</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -92,10 +105,12 @@
             <paramtype>char</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -110,10 +125,12 @@
             <paramtype>signed char</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -128,10 +145,12 @@
             <paramtype>unsigned char</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -146,10 +165,12 @@
             <paramtype>wchar_t</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -164,10 +185,12 @@
             <paramtype>short</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -182,10 +205,12 @@
             <paramtype>unsigned short</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -200,10 +225,12 @@
             <paramtype>int</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -218,10 +245,12 @@
             <paramtype>unsigned int</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -236,10 +265,12 @@
             <paramtype>long</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -254,10 +285,12 @@
             <paramtype>unsigned long</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -272,10 +305,12 @@
             <paramtype>long long</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -290,10 +325,12 @@
             <paramtype>unsigned long long</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -308,10 +345,12 @@
             <paramtype>float</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -326,10 +365,12 @@
             <paramtype>double</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -344,10 +385,12 @@
             <paramtype>long double</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -362,10 +405,12 @@
             <paramtype>std::string const&amp;</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -380,10 +425,12 @@
             <paramtype>std::wstring const&amp;</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
<para><functionname>hash_value</functionname>(val) in Boost.</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -400,9 +447,11 @@
             <paramtype>T*</paramtype>
           </parameter>
           <returns>
- <para>Unspecified in TR1, except that equal arguments yield the same result.</para> + <para>Unspecified in TR1, except that equal arguments yield the same result.<sbr/>
+            TR1 中未规定,但是相等的参数导致同样的结果。</para>
           </returns>
-          <throws><para>Doesn't throw</para></throws>
+          <throws><para>Doesn't throw<sbr/>
+          不会抛出</para></throws>
         </method>
       </struct-specialization>

@@ -421,18 +470,24 @@
         <parameter name="v"><paramtype>T const&amp;</paramtype></parameter>
         <purpose><simpara>
             Called repeatedly to incrementally create a hash value from
-            several variables.
+            several variables.<sbr/>
+            重复地调用,从几个变量递增地创建一个散列值。
         </simpara></purpose>
<effects><programlisting>seed ^= <functionname>hash_value</functionname>(v) + 0x9e3779b9 + (seed &lt;&lt; 6) + (seed &gt;&gt; 2);</programlisting></effects>
         <notes>
           <para><functionname>hash_value</functionname> is called without
-          qualification, so that overloads can be found via ADL.</para>
-          <para>This is an extension to TR1</para>
+          qualification, so that overloads can be found via ADL.<sbr/>
+          <functionname>hash_value</functionname> 被调用是不带限定的,
+          以便可以通过 ADL 找到重载。</para>
+          <para>This is an extension to TR1<sbr/>
+          这是一个对 TR1 的扩展</para>
         </notes>
         <throws>
           Only throws if <functionname>hash_value</functionname>(T) throws.
Strong exception safety, as long as <functionname>hash_value</functionname>(T)
-          also has strong exception safety.
+          also has strong exception safety.<sbr/>
+ 只有 <functionname>hash_value</functionname>(T) 抛出时,才会抛 出。 + 只要 <functionname>hash_value</functionname>(T) 具有强异常安 全,它就具有强异常安全。
         </throws>
       </function>

@@ -462,10 +517,12 @@

         <purpose><simpara>
Calculate the combined hash value of the elements of an iterator
-            range.
+            range.<sbr/>
+            计算某个迭代器区间的各元素的复合散列值。
         </simpara></purpose>
         <effects>
-          <para>For the two argument overload:
+          <para>For the two argument overload:<sbr/>
+          对于双参数重载版本:
 <programlisting>
 size_t seed = 0;

@@ -476,29 +533,35 @@

 return seed;
 </programlisting>
-          </para>For the three arguments overload:
+          </para>
+          <para>For the three arguments overload:<sbr/>
+          对于三参数重载版本:
 <programlisting>
 for(; first != last; ++first)
 {
     <functionname>hash_combine</functionname>(seed, *first);
 }
 </programlisting>
-          <para>
           </para>
         </effects>
         <notes>
           <para>
<code>hash_range</code> is sensitive to the order of the elements
             so it wouldn't be appropriate to use this with an unordered
-            container.
+            container.<sbr/>
+ <code>hash_range</code> 是受元素的顺序影响的,所以将它用于无序 容器是不合适的。
           </para>
-          <para>This is an extension to TR1</para>
+          <para>This is an extension to TR1<sbr/>
+          这是一个对 TR1 的扩展</para>
         </notes>
         <throws><para>
Only throws if <code><functionname>hash_value</functionname>(std::iterator_traits&lt;It&gt;::value_type)</code> throws. <code>hash_range(std::size_t&amp;, It, It)</code> has basic exception safety as long as <code><functionname>hash_value</functionname>(std::iterator_traits&lt;It&gt;::value_type)</code>
-          has basic exception safety.
+          has basic exception safety.<sbr/>
+ 只有 <code><functionname>hash_value</functionname>(std::iterator_traits&lt;It&gt;::value_type)</code> 抛出时, + 才会抛出。只要 <code><functionname>hash_value</functionname>(std::iterator_traits&lt;It&gt;::value_type)</code> + 具有基本异常安全,<code>hash_range(std::size_t&amp;, It, It)</code> 就具有基本异常安全。
         </para></throws>
       </overloaded-function>

@@ -512,7 +575,8 @@

       <overloaded-function name="hash_value">
         <purpose><simpara>
-            Implementation of the hash function.
+            Implementation of the hash function.<sbr/>
+            散列函数的实现。
         </simpara></purpose>

         <signature>
@@ -721,18 +785,24 @@
<classname>boost::hash</classname>, <functionname>boost::hash_range</functionname>
           or <functionname>boost::hash_combine</functionname> which
call <code>hash_value</code> without namespace qualification so that overloads
-          for custom types are found via ADL.
+          for custom types are found via ADL.<sbr/>
+ 通常不应该由用户直接调用,他们应该使用 <classname>boost::hash</classname>, + <functionname>boost::hash_range</functionname> 或 <functionname>boost::hash_combine</functionname>, + 它们以不带名字空间限定的方式调用 <code>hash_value</code>,以便通 过 ADL 找到对定制类型的重载。
         </para></description>

         <notes>
-          <para>This is an extension to TR1</para>
+          <para>This is an extension to TR1<sbr/>
+          这是一个对 TR1 的扩展</para>
         </notes>

         <throws>
             Only throws if a user supplied version of
             <code><functionname>hash_value</functionname></code>
             throws for an element of a container, or
-            one of the types stored in a pair.
+            one of the types stored in a pair.<sbr/>
+ 只有用户使用的 <code><functionname>hash_value</functionname></code> + 版本对于一个容器的元素或储存在一个 pair 中的类型会抛出时,才会 抛出。
         </throws>

         <returns>
@@ -740,8 +810,8 @@
             <tgroup cols="2">
               <thead>
                 <row>
-                  <entry>Types</entry>
-                  <entry>Returns</entry>
+                  <entry>Types 类型</entry>
+                  <entry>Returns 返回</entry>
                 </row>
               </thead>
               <tbody>
@@ -759,11 +829,13 @@
                 </row>
                 <row>
<entry><code>float</code>, <code>double</code>, <code>long double</code></entry> - <entry>An unspecified value, except that equal arguments shall yield the same result.</entry> + <entry>An unspecified value, except that equal arguments shall yield the same result.<sbr/> + 一个不定的值,但是对于相等的参数应该导致同样的结果。 </entry>
                 </row>
                 <row>
                   <entry><code>T*</code></entry>
- <entry>An unspecified value, except that equal arguments shall yield the same result.</entry> + <entry>An unspecified value, except that equal arguments shall yield the same result.<sbr/> + 一个不定的值,但是对于相等的参数应该导致同样的结果。 </entry>
                 </row>
                 <row>
                   <entry>
@@ -796,7 +868,10 @@
                   <entry>
                     <code>std::complex&lt;T&gt;</code>
                   </entry>
- <entry>When <code>T</code> is a built in type and <code>val.imag() == 0</code>, the result is equal to <code>hash_value(val.real())</code>. Otherwise an unspecified value, except that equal arguments shall yield the same result.</entry> + <entry>When <code>T</code> is a built in type and <code>val.imag() == 0</code>, the result is equal to <code>hash_value(val.real())</code>. Otherwise an unspecified value, except that equal arguments shall yield the same result.<sbr/> + 当 <code>T</code> 是一个内建类型,且 <code>val.imag() == 0</code>, + 结果与 <code>hash_value(val.real())</code> 相等。否则是一 个不定的值,
+                  但是对于相等的参数应该导致同样的结果。</entry>
                 </row>
               </tbody>
             </tgroup>
=======================================
--- /trunk/libs/functional/hash/doc/thanks.qbk  Mon Dec 28 23:05:14 2009
+++ /trunk/libs/functional/hash/doc/thanks.qbk  Mon Jan 11 23:29:12 2010
@@ -3,26 +3,35 @@
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
  / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ]

-[section:acknowledgements Acknowledgements]
+[section:acknowledgements Acknowledgements 鸣谢]

 This library is based on the design by Peter Dimov. During the initial
 development
-Joaquín M López Muñoz made many useful suggestions and contributed fixes.
+Joaquín M López Muñoz made many useful suggestions and contributed fixes.\n
+本库基于 Peter Dimov 的设计。通过最初的开发,Joaquín M López Muñoz 提出很多 有用的建议并协助修改。

The formal review was managed by Thorsten Ottosen, and the library reviewed by:
 David Abrahams, Alberto Barbati, Topher Cooper, Caleb Epstein, Dave Harris,
 Chris Jefferson, Bronek Kozicki, John Maddock, Tobias Swinger, Jaap Suter,
Rob Stewart and Pavel Vozenilek. Since then, further constructive criticism has
-been made by Daniel Krügler, Alexander Nasonov and 沈慧峰.
+been made by Daniel Krügler, Alexander Nasonov and 沈慧峰.\n
+正式的复审由 Thorsten Ottosen 管理,由 David Abrahams, Alberto Barbati, Topher Cooper, +Caleb Epstein, Dave Harris, Chris Jefferson, Bronek Kozicki, John Maddock, Tobias Swinger, +Jaap Suter, Rob Stewart 和 Pavel Vozenilek 对本库进行了复审。此后,更多的建 设性的评价由
+Daniel Krügler, Alexander Nasonov 和沈慧峰提出。

The implementation of the hash function for pointers is based on suggestions
 made by Alberto Barbati and Dave Harris. Dave Harris also suggested an
-important improvement to [funcref boost::hash_combine] that was taken up.
+important improvement to [funcref boost::hash_combine] that was taken up.\n
+指针的散列函数的实现基于 Alberto Barbati 和 Dave Harris 的建议。Dave Harris
+也针对 boost::hash_combine 提出了一个重要的改进,并被采纳。

Some useful improvements to the floating point hash algorithm were suggested
-by Daniel Krügler.
+by Daniel Krügler.\n
+一些针对浮点散列算法的有用的改进由 Daniel Krügler 提出。

 The original implementation came from Jeremy B. Maitin-Shepard's hash table
-library, although this is a complete rewrite.
+library, although this is a complete rewrite.\n
+最初的实现来自于 Jeremy B. Maitin-Shepard 的散列表库,尽管这是一次完全的重 写。

 [endsect]
=======================================
--- /trunk/libs/functional/hash/doc/tutorial.qbk        Mon Dec 28 23:05:14 2009
+++ /trunk/libs/functional/hash/doc/tutorial.qbk        Mon Jan 11 23:29:12 2010
@@ -6,16 +6,21 @@
 [def __multi-index-short__ [@boost:/libs/multi_index/doc/index.html
     Boost.MultiIndex]]

-[section:tutorial Tutorial]
+[section:tutorial Tutorial 指南]

 When using a hash index with __multi-index-short__, you don't need to do
 anything to use [classref boost::hash] as it uses it by default.
 To find out how to use a user-defined type, read the
-[link hash.custom section on extending boost::hash for a custom data type].
+[link hash.custom section on extending boost::hash for a custom data type].\n +当一个散列索引和 __multi-index-short__ 一起使用时,为了使用 [classref boost::hash],
+你不必做什么事,它总是被缺省使用。如果想知道使用一个用户定义类型,请阅读
+[link hash.custom 为定制数据类型扩展 boost::hash]。

 If your standard library supplies its own implementation of the unordered
 associative containers and you wish to use
-[classref boost::hash], just use an extra template parameter:
+[classref boost::hash], just use an extra template parameter:\n
+如果你的标准库使用它自己实现的无序关联式容器,而你又想使用 [classref boost::hash],
+只需要使用一个额外的模板参数:

     std::unordered_multiset<int, ``[classref boost::hash]``<int> >
             set_of_ints;
@@ -25,7 +30,8 @@

std::unordered_map<int, std::string, ``[classref boost::hash]``<int> > map_int_to_string;

-To use [classref boost::hash] directly, create an instance and call it as a function: +To use [classref boost::hash] directly, create an instance and call it as a function:\n
+为了直接是使用 [classref boost::hash],创建一个实例并像一个函数一样调用它:

     #include <``[headerref boost/functional/hash.hpp]``>

@@ -37,7 +43,8 @@
     }

 For an example of generic use, here is a function to generate a vector
-containing the hashes of the elements of a container:
+containing the hashes of the elements of a container:\n
+一个普通的使用示例,这是一个函数,它生成一个 vector,包含一个容器中的元素的 散列值:

     template <class Container>
     std::vector<std::size_t> get_hashes(Container const& x)
@@ -51,16 +58,20 @@

 [endsect]

-[section:custom Extending boost::hash for a custom data type]
+[section:custom Extending boost::hash for a custom data type 为定制数据类型 扩展 boost::hash]

 [classref boost::hash] is implemented by calling the function
 [funcref boost::hash_value hash_value].
 The namespace isn't specified so that it can detect overloads via argument
 dependant lookup. So if there is a free function `hash_value` in the same
-namespace as a custom type, it will get called.
+namespace as a custom type, it will get called.\n
+[classref boost::hash] 通过调用函数 [funcref boost::hash_value hash_value] 生效。 +不指定名字空间,它就能通过参数依赖查找探测重载。所以,如果有一个自由函数 `hash_value`
+和一个定制类型在同一个名字空间中,它就可以被调用。

 If you have a structure `library::book`, where each `book` is uniquely
-defined by it's member `id`:
+defined by it's member `id`:\n
+如果你有一个结构 `library::book`,每一个 `book` 通过它的成员 `id` 来唯一确 定:

     namespace library
     {
@@ -79,7 +90,8 @@
         }
     }

-Then all you would need to do is write the function `library::hash_value`:
+Then all you would need to do is write the function `library::hash_value`:\n
+那么你需要做的全部就是编写函数 `library::hash_value`:

     namespace library
     {
@@ -90,7 +102,8 @@
         }
     }

-And you can now use [classref boost::hash] with book:
+And you can now use [classref boost::hash] with book:\n
+现在你就可以使用 book 的 [classref boost::hash] 了:

     library::book knife(3458, "Zane Grey", "The Hash Knife Outfit");
     library::book dandelion(1354, "Paul J. Shanley",
@@ -100,6 +113,7 @@
     std::size_t knife_hash_value = book_hasher(knife);

     // If std::unordered_set is available:
+    // 如果 std::unordered_set 可用:
std::unordered_set<library::book, ``[classref boost::hash]``<library::book> > books;
     books.insert(knife);
     books.insert(library::book(2443, "Lindgren, Torgny", "Hash"));
@@ -112,7 +126,9 @@
 The full example can be found in:
[@boost:/libs/functional/hash/examples/books.cpp /libs/functional/hash/examples/books.hpp]
 and
-[@boost:/libs/functional/hash/examples/books.cpp /libs/functional/hash/examples/books.cpp]. +[@boost:/libs/functional/hash/examples/books.cpp /libs/functional/hash/examples/books.cpp].\n +完整的例子可以在 [@boost:/libs/functional/hash/examples/books.cpp /libs/functional/hash/examples/books.hpp] +和 [@boost:/libs/functional/hash/examples/books.cpp /libs/functional/hash/examples/books.cpp] 找到。

 [tip
When writing a hash function, first look at how the equality function works.
@@ -121,14 +137,18 @@
 In this object equality was based just on the id so the hash function
 only hashes the id. If it was based on the object's name and author
 then the hash function should take them into account
-(how to do this is discussed in the next section).
-]
+(how to do this is discussed in the next section).\n
+在写散列函数时,首先看一下判断相等的函数如何工作。相等的对象必须生成相同的 散列值。
+如果对象不相等,它们就应该生成不同的散列值。在这个对象里相等仅仅基于 id,
+所以散列函数仅仅散列了 id。如果它基于对象名和作者,那么散列函数就应该考虑它
+(如何做到这一点在下一部分讨论)。]

 [endsect]

-[section:combine Combining hash values]
-
-Say you have a point class, representing a two dimensional location:
+[section:combine Combining hash values 结合散列值]
+
+Say you have a point class, representing a two dimensional location:\n
+假设你有一个 point 类,代表一个二维空间上的位置:

     class point
     {
@@ -147,7 +167,10 @@
 and you wish to use it as the key for an `unordered_map`. You need to
 customise the hash for this structure. To do this we need to combine
 the hash values for `x` and `y`. The function
-[funcref boost::hash_combine] is supplied for this purpose:
+[funcref boost::hash_combine] is supplied for this purpose:\n
+而你要用它作为一个 `unordered_map` 中的键。你就要为这个结构定制散列。
+为了做到这一点,我们要结合 `x` 和 `y` 的散列值。函数 [funcref boost::hash_combine]
+就用于这个目的:

     class point
     {
@@ -167,21 +190,26 @@

Calls to hash_combine incrementally build the hash from the different members
 of point, it can be repeatedly called for any number of elements. It calls
-[funcref boost::hash_value hash_value] on the supplied element, and combines it with the seed. +[funcref boost::hash_value hash_value] on the supplied element, and combines it with the seed.\n +对 hash_combine 的调用从 point 的不同成员逐步建造出散列,它可以对任何数量的 部件重复调用。 +它在提供的部件上调用 [funcref boost::hash_value hash_value],并将它和 seed 结合在一起。

 Full code for this example is at
-[@boost:/libs/functional/hash/examples/point.cpp /libs/functional/hash/examples/point.cpp]. +[@boost:/libs/functional/hash/examples/point.cpp /libs/functional/hash/examples/point.cpp].\n +这个例子的完整代码在 [@boost:/libs/functional/hash/examples/point.cpp /libs/functional/hash/examples/point.cpp]。

 [note
 When using [funcref boost::hash_combine] the order of the
-calls matters.
+calls matters.\n
+使用 [funcref boost::hash_combine] 时调用顺序的问题。
 '''
 <programlisting>
     std::size_t seed = 0;
     boost::hash_combine(seed, 1);
     boost::hash_combine(seed, 2);
 </programlisting>
-results in a different seed to:
+results in a different seed to:\n
+与以下代码将得到不同的 seed:
 <programlisting>
     std::size_t seed = 0;
     boost::hash_combine(seed, 2);
@@ -190,10 +218,13 @@
 '''
 If you are calculating a hash value for data where the order of the data
 doesn't matter in comparisons (e.g. a set) you will have to ensure that the
-data is always supplied in the same order.
+data is always supplied in the same order.\n
+如果你要为顺序没什么关系的数据(比如,一个 set)计算一个散列值,
+你就必须确保这些数据总是以同样的顺序被使用。
 ]

-To calculate the hash of an iterator range you can use [funcref boost::hash_range]: +To calculate the hash of an iterator range you can use [funcref boost::hash_range]:\n
+为了计算一个迭代器 range 的散列,你可以用 [funcref boost::hash_range]:

     std::vector<std::string> some_strings;
std::size_t hash = ``[funcref boost::hash_range]``(some_strings.begin(), some_strings.end());
=======================================
--- /trunk/libs/intrusive/doc/intrusive.qbk     Mon Dec 28 23:05:14 2009
+++ /trunk/libs/intrusive/doc/intrusive.qbk     Mon Jan 11 23:29:12 2010
@@ -19,45 +19,56 @@
     ]
 ]

-[section:introduction Introduction]
-
-[section:introduction_presenting Presenting Boost.Intrusive]
+[section:introduction Introduction 简介]
+
+[section:introduction_presenting Presenting Boost.Intrusive 介绍 Boost.Intrusive]

 [*Boost.Intrusive] is a library presenting some intrusive containers to
 the world of C++. Intrusive containers are special containers
 that offer [link intrusive.performance better performance]
-and exception safety guarantees than non-intrusive containers (like STL containers). +and exception safety guarantees than non-intrusive containers (like STL containers). \n +[*Boost.Intrusive] 是一个将介入式容器引入到C++世界的库。介入式容器是一种特 殊的容器, +它提供比非介入式容器(如STL容器) [link intrusive.performance 更好的性能] 和 异常安全保证。

The performance benefits of intrusive containers makes them ideal as a building block to efficiently construct complex containers like multi-index containers or
-to design high performance code like memory allocation algorithms.
+to design high performance code like memory allocation algorithms.\n
+介入式容器的性能优点使得它们成为一种构建块,用以高效地构造复杂容器,如多索 引容器,
+或者用以设计高性能代码,如内存分配算法。

 While intrusive containers were and are widely used in C, they
 became more and more forgotten in C++ due to the presence of the standard
containers which don't support intrusive techniques.[*Boost.Intrusive] not only reintroduces this technique to C++, but also encapsulates the implementation in STL-like interfaces. Hence anyone familiar with standard containers can easily use
-[*Boost.Intrusive].
+[*Boost.Intrusive].\n
+虽然介入式容器在C中被广泛使用,但是在C++中却被日渐遗忘,这是由于不支持介入 式技术的标准容器的出现。 +[*Boost.Intrusive] 不仅重新将这一技术引入到C++,而且还将实现封装为类似于 STL的接口。
+所以每一个熟悉标准容器的人都可以很容易地使用 [*Boost.Intrusive]

 [endsect]

-[section:introduction_building_intrusive Building Boost.Intrusive]
+[section:introduction_building_intrusive Building Boost.Intrusive 构建 Boost.Intrusive ]

 There is no need to compile anything to use [*Boost.Intrusive], since it's
 a header only library. Just include your Boost header directory in your
-compiler include path.
+compiler include path.\n
+使用  [*Boost.Intrusive] 不需要编译任何东西,因为它是一个仅有头文件的库。
+只需要将你的 Boost 头文件目录包含在你的编译器包含路径中就可以了。

 [endsect]

 [endsect]

-[section:intrusive_vs_nontrusive Intrusive and non-intrusive containers]
-
-[section:differences_intrusive_vs_nontrusive Differences between intrusive and non-intrusive containers] +[section:intrusive_vs_nontrusive Intrusive and non-intrusive containers 介 入式和非介入式容器]
+
+[section:differences_intrusive_vs_nontrusive Differences between intrusive and non-intrusive containers 介入式和非介入式容器的区别]

The main difference between intrusive containers and non-intrusive containers is that in C++ non-intrusive containers store [*copies] of values passed by the user. -Containers use the `Allocator` template parameter to allocate the stored values: +Containers use the `Allocator` template parameter to allocate the stored values:\n +介入式容器与非介入式容器的主要区别在于,在C++非介入式容器中保存的是由用户传 入的值的[*拷贝]。
+容器使用 Allocator 模块参数来分配被保存的值:

 [c++]

@@ -72,6 +83,7 @@
       myclass_list.push_back(myclass);

       //The stored object is different from the original object
+      //被保存的对象不同于原始对象
       assert(&myclass != &myclass_list.front());
       return 0;
    }
@@ -79,11 +91,14 @@

To store the newly allocated copy of `myclass`, the container needs additional
 data: `std::list` usually allocates nodes that contain pointers to the
-next and previous node and the value itself. Something similar to:
+next and previous node and the value itself. Something similar to:\n
+为了保存新分配的 `myclass` 拷贝,容器需要其它的数据:`std::list` 通常要分配 节点,
+节点中包含有到下一个和前一个节点的指针,和它本身的值。这类似于:

 [c++]

    //A possible implementation of a std::list<MyClass> node
+   //一个 std::list<MyClass> 节点的可能实现
    class list_node
    {
       list_node *next;
@@ -96,7 +111,9 @@
but it stores the objects themselves. The additional data needed to insert the object in the container must be provided by the object itself. For example, to insert `MyClass` in an intrusive container that implements a linked list, `MyClass` must contain the
-needed ['next] and ['previous] pointers:
+needed ['next] and ['previous] pointers:\n
+另一方面,介入式容器则不保存传入对象的拷贝,而是保存对象本身。需要插入到容 器中对象里的额外数据必须由对象本身提供。 +例如,要将 `MyClass` 插入到一个实现了链表功能的介入式容器中,`MyClass` 必须 包含所需的 ['next] 和 ['previous] 指针:

 [c++]

@@ -104,7 +121,7 @@
    {
       MyClass *next;
       MyClass *previous;
-      //Other members...
+      //Other members... 其它成员...
    };

    int main()
@@ -115,120 +132,159 @@
       list.push_back(myclass);

       //"myclass" object is stored in the list
+      //"myclass" 对象保存在 list 中
       assert(&myclass == &list.front());
       return 0;
    }

As we can see, knowing which additional data the class should contain is not an easy task. [*Boost.Intrusive] offers several intrusive containers and an easy
-way to make user classes compatible with those containers.
+way to make user classes compatible with those containers.\n
+正如我们所看到的,知道这个类要包含哪些额外的数据可不是一件容易的工作。 [*Boost.Intrusive]
+提供了多个介入式容器以及一个容易的方法来让用户类可以兼容于这些容器。

 [endsect]

-[section:properties_of_intrusive Properties of Boost.Intrusive containers]
+[section:properties_of_intrusive Properties of Boost.Intrusive containers Boost.Intrusive容器的特点 ]

 Semantically, a [*Boost.Intrusive] container is similar to a STL container
 holding pointers to objects. That is, if you have an intrusive list holding
 objects of type `T`, then `std::list<T*>` would allow you to do quite the
 same operations (maintaining and navigating a set of objects of type T and
-types derived from it).
-
-A non-intrusive container has some limitations:
+types derived from it). \n
+语义上,一个 [*Boost.Intrusive] 容器类似于一个保存对象指针的STL容器。即,
+如果你有一个保存类型 `T` 的对象的介入式 list,那么 `std::list<T*>`
+也允许你做完全相同的操作(维护和操纵一组类型为 T 或其派生类的对象)。
+
+A non-intrusive container has some limitations:\n
+非介入式容器有一些限制:

* An object can only belong to one container: If you want to share an object between two containers, you either have to store multiple copies of those
-   objects or you need to use containers of pointers: `std::list<Object*>`.
+ objects or you need to use containers of pointers: `std::list<Object*>`.\n + 一个对象只能属于一个容器:如果你想在两个容器间共享一个对象,你要么必须保 存多份拷贝,
+   要么就需要使用指针容器:`std::list<Object*>`.

* The use of dynamic allocation to create copies of passed values can be a performance and size bottleneck in some applications. Normally, dynamic allocation imposes a size overhead for each allocation to store bookkeeping information and a - synchronization to protected concurrent allocation from different threads. + synchronization to protected concurrent allocation from different threads.\n + 在一些应用中,为传入值创建拷贝所用的动态分配可能成为性能和空间的瓶颈。通 常, + 动态分配需要为每次分配增加一些空间开销来保簿记信息,还有同步操作以保护来 自不同线程的并发分配。

* Only copies of objects are stored in non-intrusive containers. Hence copy or move constructors and copy or move assignment operators are required. Non-copyable
-   and non-movable objects can't be stored in non-intrusive containers.
+   and non-movable objects can't be stored in non-intrusive containers.\n
+ 在非介入式容器中只能保存对象的拷贝。因此,需要复制或移动构造函数和复制或 移动赋值操作符。
+   不可复制和不可移动的对象不能保存在非介入式容器中。

 *  It's not possible to store a derived object in a STL-container while
-   retaining its original type.
-
-Intrusive containers have some important advantages:
+   retaining its original type.\n
+   不可能将一个派生类对象保存在STL容器中而且保留它的原本类型。
+
+Intrusive containers have some important advantages: \n
+介入式容器具有以下重要优点:

* Operating with intrusive containers doesn't invoke any memory management at all. - The time and size overhead associated with dynamic memory can be minimized. + The time and size overhead associated with dynamic memory can be minimized.\n + 介入式容器的操作根本不会引发任何内存管理。动态内存分配所带来的时间和空间 开销可以被最小化。

* Iterating an Intrusive container needs less memory accesses than the semantically
-   equivalent container of pointers: iteration is faster.
+   equivalent container of pointers: iteration is faster.\n
+   介入式容器的迭代比相同语义的指针容器需要更少的内存访问:迭代可以更快。

* Intrusive containers offer better exception guarantees than non-intrusive containers. In some situations intrusive containers offer a no-throw guarantee that can't be
-   achieved with non-intrusive containers.
+   achieved with non-intrusive containers.\n
+ 介入式容器提供了比非介入式容器更好的异常保证。在一些情形下,介入式容器提 供了无抛出保证,
+   而非介入式容器是不可能达到的。

* The computation of an iterator to an element from a pointer or reference to that element is a constant time operation (computing the position of `T*` in a `std::list<T*>` has
-   linear complexity).
+   linear complexity).\n
+ 从一个元素的指针或引用计算该元素的迭代器是常量时间操作(而在 `std::list<T*>` 中计算一个 `T*`
+   的位置则具有线性复杂度)。

* Intrusive containers offer predictability when inserting and erasing objects since no memory management is done with intrusive containers. Memory management usually is not a predictable operation so complexity guarantees from non-intrusive containers are looser than the guarantees
-   offered by intrusive containers.
-
-Intrusive containers have also downsides:
+   offered by intrusive containers.\n
+ 介入式容器在插入和删除对象时提供了可预见性,因为介入式容器不需要内存管 理。内存管理通常都不是一个可预见的操作,
+   因此非介入式容器的复杂度保证要比介入式容器所提供的保证宽松。
+
+Intrusive containers have also downsides:\n
+介入式容器也有缺点:

* Each type stored in an intrusive container needs additional memory holding the maintenance information needed by the container. Hence, whenever a certain type will be stored in an intrusive container [*you have to change the definition of that type] appropriately. Although this task is easy with [*Boost.Intrusive], touching the
-   definition of a type is sometimes a crucial issue.
+   definition of a type is sometimes a crucial issue.\n
+ 保存在介入式容器中的类型需要额外的内存来保存容器所需的维护信息。因此,当 某个特定类型要被保存在介入式容器中时, + [*你必须适当地修改该类型的定义]。虽然这一工作对于 [*Boost.Intrusive] 来 说很容易,
+   但是有时候触动类型的定义也是一个关键问题。

* In intrusive containers you don't store a copy of an object, [*but rather the original object is linked with other objects in the container]. Objects don't need copy-constructors or assignment operators to be stored in intrusive containers. But you have to take care of possible side effects, whenever you change the contents of an object (this is especially important for
-   associative containers).
+   associative containers).\n
+ 在介入式容器中,你不能保存一个对象的拷贝,[*而是将原来的对象和容器中的其 它对象链接起来]。 + 对象不需要复制构造函数或赋值操作符来保存到介入式容器中。但是在修改对象的 内容时,
+   你必须小心可能存在的副作用(这对于关联式容器尤其重要)。

* The user [*has to manage the lifetime of inserted objects] independently from the
-   containers.
+   containers.\n
+   用户必须独立于容器[*管理被插入对象的生存期]。

* Again you have to be [*careful]: in contrast to STL containers [*it's easy to render an iterator invalid] without touching the intrusive container directly, because the object
-   can be disposed before is erased from the container.
+   can be disposed before is erased from the container.\n
+ 你还必须[*小心]:与STL容器相比,[*它更容易引致迭代器失效],即使没有直接 触动介入式容器,
+   因为对象可能在被从容器中移除之前就销毁。

* [*Boost.Intrusive] containers are [*non-copyable and non-assignable]. Since intrusive containers don't have allocation capabilities, these operations make no sense. However, swapping can be used to implement move capabilities. To ease the implementation of copy constructors and assignment operators of classes storing [*Boost.Intrusive]
    containers, [*Boost.Intrusive] offers special cloning functions. See
- [link intrusive.clone_from Cloning [*Boost.Intrusive] containers] section for more information. + [link intrusive.clone_from Cloning [*Boost.Intrusive] containers] section for more information.\n + [*Boost.Intrusive] 容器是[*不可复制和不可赋值的]。因为介入式容器没有分配 内存的能力, + 所以这些操作是没有意义的。但是,交换操作可用于实现移动的能力。为了减轻保 存在 [*Boost.Intrusive] + 容器中的类的复制构造函数和赋值操作符的实现难度,[*Boost.Intrusive] 提供 了特殊的克隆函数。 + 更多信息请见 [link intrusive.clone_from 克隆[*Boost.Intrusive]容器] 一 节。

* Analyzing the thread safety of a program that uses containers is harder with intrusive containers, because - the container might be modified indirectly without an explicit call to a container member.
-
-[table Summary of intrusive containers advantages and disadvantages
- [[Issue] [Intrusive] [Non-intrusive]] - [[Memory management] [External] [Internal through allocator]] - [[Insertion/Erasure time] [Faster] [Slower]] - [[Memory locality] [Better] [Worse]] - [[Can hold non-copyable and non-movable objects by value] [Yes] [No]] - [[Exception guarantees] [Better] [Worse]] - [[Computation of iterator from value] [Constant] [Non-constant]] - [[Insertion/erasure predictability] [High] [Low]] - [[Memory use] [Minimal] [More than minimal]] - [[Insert objects by value retaining polymorphic behavior] [Yes] [No (slicing)]] - [[User must modify the definition of the values to insert] [Yes] [No]] - [[Containers are copyable] [No] [Yes]] - [[Inserted object's lifetime managed by] [User (more complex)] [Container (less complex)]] - [[Container invariants can be broken without using the container] [Easier] [Harder (only with containers of pointers)]] - [[Thread-safety analysis] [Harder] [Easier]] + the container might be modified indirectly without an explicit call to a container member.\n + 分析一个使用容器的程序的线程安全要比分析介入式容器更困难,因为可以无需显 式调用容器的成员函数就间接修改该容器。
+
+[table Summary of intrusive containers advantages and disadvantages 介入式 容器优缺点总结 + [[Issue 问题 ] [Intrusive 介入式] [Non-intrusive 非介入式 ]] + [[Memory management\n内存管理 ] [External\n外部 ] [Internal through allocator\n内部,通过分配器]] + [[Insertion/Erasure time\n插入/删除的时间 ] [Faster\n较快 ] [Slower\n较慢]] + [[Memory locality\n内存局部性 ] [Better\n较好 ] [Worse\n较差]] + [[Can hold non-copyable and non-movable objects by value\n可否以值方式 保存不可复制和不可移动的对象] [Yes\n可以 ] [No\n不可]] + [[Exception guarantees\n异常保证 ] [Better\n较好 ] [Worse\n较差]] + [[Computation of iterator from value\n从值计算迭代器 ] [Constant\n常量复杂度 ] [Non-constant\n非常量复杂度]] + [[Insertion/erasure predictability\n插入/删除操作的可预见性 ] [High\n高 ] [Low\n低]] + [[Memory use\n内存占用 ] [Minimal\n最少] [More than minimal\n比最少多]] + [[Insert objects by value retaining polymorphic behavior\n以值方式插入 的对象保持多态行为] [Yes\n是 ] [No (slicing)\n不是(切片)]] + [[User must modify the definition of the values to insert\n用户必须修改 值的定义以便插入] [Yes\n是] [No\n否]] + [[Containers are copyable\n容器是可复制的 ] [No\n否 ] [Yes\n是]] + [[Inserted object's lifetime managed by\n被插入对象的生存期由谁管理 ] [User (more complex)\n用户(较复杂 )] [Container (less complex)\n容器(较不复杂)]] + [[Container invariants can be broken without using the container\n不使 用容器也能破坏容器的不变式] [Easier\n较容易 ] [Harder (only with containers of pointers)\n较 难(只有使用指针容器才会)]] + [[Thread-safety analysis线程安全性分析 ] [Harder\n较难 ] [Easier\n较容易]]
 ]

For a performance comparison between Intrusive and Non-intrusive containers see
-[link intrusive.performance Performance] section.
+[link intrusive.performance Performance] section.\n
+有关介入式容器与非介入式容器的性能比较,请见 [link intrusive.performance 性 能] 一节。

 [endsect]

 [endsect]

-[section:usage How to use Boost.Intrusive]
+[section:usage How to use Boost.Intrusive 如何使用Boost.Intrusive]

If you plan to insert a class in an intrusive container, you have to make some decisions influencing the class definition itself. Each class that will be used in an intrusive
@@ -237,7 +293,12 @@
([classref boost::intrusive::list boost::intrusive::list]), for the following examples, but all [*Boost.Intrusive] containers are very similar. To compile
 the example using [classref boost::intrusive::list boost::intrusive::list],
-just include:
+just include:\n
+如果你计划将一个类插入到介入式容器中,你必须作出一些影响这个类本身的定义的 决定。 +每一个要在介入式容器中使用的类都需要一些适当的数据成员,来保存容器所需的信 息。 +以下例子,我们将看到一个简单的介入式容器:介入式链表([classref boost::intrusive::list boost::intrusive::list]), +不过所有的 [*Boost.Intrusive] 容器都非常相似。要编译使用 [classref boost::intrusive::list boost::intrusive::list]
+的例子,只要包含:

 [c++]

@@ -246,12 +307,15 @@
Every class to be inserted in an intrusive container, needs to contain a hook that will offer the necessary data and resources to be insertable in the container. With [*Boost.Intrusive] you just choose the hook to be a public base class or
-a public member of the class to be inserted.
-
-[section:usage_base_hook Using base hooks]
+a public member of the class to be inserted.\n
+每一个被插入到介入式容器中的类,为了可以插入到容器,都要包含一个钩子,它提 供了必要的数据和资源。 +对于 [*Boost.Intrusive],你只需选择是用被插入类的公有基类,还是被插入类的公 有成员来实现钩子。
+
+[section:usage_base_hook Using base hooks 使用基类钩子]

 For [classref boost::intrusive::list list], you can publicly derive from
-[classref boost::intrusive::list_base_hook list_base_hook].
+[classref boost::intrusive::list_base_hook list_base_hook].\n
+对于 [classref boost::intrusive::list list],你可以公有派生自 [classref boost::intrusive::list_base_hook list_base_hook].

 [c++]

@@ -259,29 +323,42 @@
    class list_base_hook;

The class can take several options. [*Boost.Intrusive] classes receive arguments in the
-form `option_name<option_value>`. You can specify the following options:
+form `option_name<option_value>`. You can specify the following options: \n +该类可以接受几个选项。[*Boost.Intrusive] 以 `option_name<option_value>` 的 形式来接受实参。你可以指定以下选项:

* [*`tag<class Tag>`]: this argument serves as a tag, so you can derive from more than one [classref boost::intrusive::list_base_hook list_base_hook] and hence put an object in multiple intrusive lists at the same time. An incomplete type can serve as a tag.
    If you specify two base hooks, you [*must] specify a different
tag for each one. Example: `list_base_hook< tag<tag1> >`. If no tag is specified
-   a default one will be used (more on default tags later).
+   a default one will be used (more on default tags later).\n
+ [*`tag<class Tag>`]: 该实参被作为一个标记,这样你就可以派生自多个 [classref boost::intrusive::list_base_hook list_base_hook], + 从而将一个对象同时放入多个介入式链表。一个不完整的类型就可以作为标记。如 果你指定了两个基类钩子, + 你[*必须]为每一个指定不同的标记。例如:`list_base_hook< tag<tag1> >`。如 果未指定标记,
+   则使用一个缺省值(稍后对缺省标记再作说明)。

* [*`link_mode<link_mode_type LinkMode>`]: The second template argument controls the
    linking policy. [*Boost.Intrusive] currently supports
3 modes: `normal_link`, `safe_link` and `auto_unlink`. By default, `safe_link`
    mode is used. More about these in sections
[link intrusive.safe_hook Safe hooks] and [link intrusive.auto_unlink_hooks Auto-unlink hooks].
-   Example: `list_base_hook< link_mode<auto_unlink> >`
+   Example: `list_base_hook< link_mode<auto_unlink> >`\n
+ [*`link_mode<link_mode_type LinkMode>`]: 第二个模板实参控制链接策略。目 前 [*Boost.Intrusive] 支持3种模式: + `normal_link`, `safe_link` 和 `auto_unlink`。缺省使用 `safe_link` 模式。 更多说明在 + [link intrusive.safe_hook 安全钩子] 和 [link intrusive.auto_unlink_hooks 自断钩子] 章节。
+   例如:`list_base_hook< link_mode<auto_unlink> >`

* [*`void_pointer<class VoidPointer>`]: this option is the pointer type to be used internally in the hook. The default value is `void *`, which means that raw pointers
    will be used in the hook. More about this in the section titled
[link intrusive.using_smart_pointers Using smart pointers with Boost.Intrusive containers].
-   Example: `list_base_hook< void_pointer< my_smart_ptr<void> >`
-
-For the following examples, let's forget the options and use the default values:
+   Example: `list_base_hook< void_pointer< my_smart_ptr<void> >`\n
+ [*`void_pointer<class VoidPointer>`]: 这一选项是钩子内部所使用的指针类 型。缺省值为 `void *`, + 这意味着在钩子中将使用裸指针。更多说明在 [link intrusive.using_smart_pointers 在 Boost.Intrusive 容器中使用智能指针] 一节。
+   例子:`list_base_hook< void_pointer< my_smart_ptr<void> >`
+
+For the following examples, let's forget the options and use the default values:\n
+以下例子中,让我们忘记这些选项,只使用缺省值:

 [c++]

@@ -291,10 +368,12 @@

    class Foo
       //Base hook with default tag, raw pointers and safe_link mode
+      //带缺省标记、裸指针和 safe_link 模式的基类钩子
       :  public list_base_hook<>
    { /**/ };

-After that, we can define the intrusive list:
+After that, we can define the intrusive list:\n
+然后,我们就可以定义介入式链表:

 [c++]

@@ -302,7 +381,8 @@
    class list;

`list` receives the type to be inserted in the container (`T`) as the first parameter
-and optionally, the user can specify options. We have 3 option types:
+and optionally, the user can specify options. We have 3 option types:\n
+`list` 将被插入到容器中的类型(`T`) 作为第一个参数,并接受其它由用户指定的可 选项。我们有3个选项类型:

* [*`base_hook<class Hook>`] / [*`member_hook<class T, class Hook, Hook T::* PtrToMember>`] / [*`value_traits<class ValueTraits>`]: All these options specify the relationship
@@ -313,12 +393,19 @@
[*If no option is specified, the container will be configured to use the base
    hook with the default tag].
Some options configured for the hook (the type of the pointers, link mode, etc.)
-   will be propagated to the container.
+   will be propagated to the container.\n
+ [*`base_hook<class Hook>`] / [*`member_hook<class T, class Hook, Hook T::* PtrToMember>`] / + [*`value_traits<class ValueTraits>`]: 所有这些选项都是指定插入到链表中的 类型 `T` 与钩子之间的关系 + (因为对于同一个类型 `T`,我们可以有多个钩子)。`member_hook` 稍后解 释,`value_traits` 则将在 + [link intrusive.value_traits 带定制化 ValueTraits 的容器] 一节中解释。 [*如果未指定选项, + 容器将被配置为使用带缺省标记的基类钩子]。为钩子所配置的选项(指针类型、链 接模式等等)将被传到容器。

* [*`constant_time_size<bool Enabled>`]: Specifies if a constant time `size()`
    function is demanded for the container. This will instruct the intrusive
container to store an additional member to keep track of the current size of the
-   container. By default, constant-time size is activated.
+   container. By default, constant-time size is activated.\n
+ [*`constant_time_size<bool Enabled>`]: 指定容器是否需要一个常量时间的 `size()` 函数。 + 它将通知介入式容器保存一个额外成员,以跟踪容器的当前大小。缺省情况下,常 量时间大小被激活。

 *  [*`size_type<bool Enabled>`]: Specifies a type that can hold
the size of the container. This type will be the type returned by `list.size()`
@@ -328,23 +415,30 @@
containers can have a `size_type` that might be different from `std::size_t` (for example, STL-like containers use the `size_type` defined by their allocator). [*Boost.Intrusive] can be used to implement such containers specifying the
-   the type of the size. By default the type is `std::size_t`.
+   the type of the size. By default the type is `std::size_t`.\n
+ [*`size_type<bool Enabled>`]: 指定一个可以保存容器大小的类型。如果 `constant_time_size<true>` 被请求, + 则该类型将作为 `list.size()` 的返回类型并保存在介入式容器中。用户通常不 需要修改这一类型, + 不过有些容器可能具有一个不同于 `std::size_t` 的 `size_type` (例如,类 -STL容器使用由它们的分配器所定义的 + `size_type`)。[*Boost.Intrusive] 可以用于实现指定大小类型的容器。该类型 的缺省值为 `std::size_t`.

Example of a constant-time size intrusive list that will store Foo objects, using
-the base hook with the default tag:
+the base hook with the default tag:\n
+以下例子是一个保存 Foo 对象,使用基类钩子,带缺省标记,含常量时间大小函数的 介入式链表:

 [c++]

    typedef list<Foo> FooList;

-Example of a intrusive list with non constant-time size that will store Foo objects: +Example of a intrusive list with non constant-time size that will store Foo objects:\n
+以下例子是一个保存 Foo 对象,不含常量时间大小函数的介入式链表:

 [c++]

    typedef list<Foo, constant_time_size<false> > FooList;

Remember that the user must specify the base hook if the base hook has no default tag
-(e.g: if more than one base hook is used):
+(e.g: if more than one base hook is used):\n
+请记住,如果基类钩子没有缺省标记,用户必须指定该基类钩子(如:如果有一个以上 的基类钩子):

 [c++]

@@ -360,11 +454,13 @@

    typedef list< Foo, base_hook<BaseHook> > FooList;

-Once the list is defined, we can use it:
+Once the list is defined, we can use it:\n
+定义了该链表后,我们就可以使用它了:

 [c++]

    //An object to be inserted in the list
+   //插入到链表中的对象
    Foo foo_object;
    FooList list;

@@ -374,21 +470,25 @@

 [endsect]

-[section:usage_member_hook Using member hooks]
+[section:usage_member_hook Using member hooks 使用成员钩子]

Sometimes an 'is-a' relationship between list hooks and the list value types is not desirable. In this case, using a member hook as a data member instead of 'disturbing' the hierarchy might be the right way: you can add a public data
 member `list_member_hook<...>` to your class.
 This class can be configured with the same options as `list_base_hook`
-except the option `tag`:
+except the option `tag`:\n
+有时候,链表钩子和链表值类型之间的 'is-a' 关系是不合理的。这时,使用一个成 员钩子作为数据成员, +而不是'打乱'类的继承层次,可能是正确的方法:你可增加一个公有数据成员 `list_member_hook<...>` 到你的类中。
+该类可以用和 `list_base_hook` 一样的选项来配置,除了 `tag` 选项:

 [c++]

    template <class ...Options>
    class list_member_hook;

-Example:
+Example:\n
+例如:

 [c++]

@@ -402,21 +502,26 @@
    };

When member hooks are used, the `member_hook` option is used to configure the
-list:
+list:\n
+使用成员钩子时,`member_hook` 选项被用于配置链表:

 [c++]

    //This option will configure "list" to use the member hook
+   //这个选项将 "list" 配置为使用成员钩子
typedef member_hook<Foo, list_member_hook<>, &Foo::hook_> MemberHookOption;

    //This list will use the member hook
+   //这个 list 将使用成员钩子
    typedef list<Foo, MemberHookOption> FooList;

-Now we can use the container:
+Now we can use the container:\n
+现在我们就可以使用这个容器了:

 [c++]

    //An object to be inserted in the list
+   //被插入到链表中的对象
    Foo foo_object;
    FooList list;

@@ -426,53 +531,71 @@

 [endsect]

-[section:usage_both_hooks Using both hooks]
+[section:usage_both_hooks Using both hooks 使用两种钩子]

You can insert the same object in several intrusive containers at the same time, -using one hook per container. This is a full example using base and member hooks: +using one hook per container. This is a full example using base and member hooks:\n +你可以将同一个对象同时插入到多个介入式容器中,每个容器使用一个钩子。以下是 一个使用基类钩子和成员钩子的完整例子:

 [import ../example/doc_how_to_use.cpp]
 [doc_how_to_use_code]

 [endsect]

-[section:usage_lifetime Object lifetime]
+[section:usage_lifetime Object lifetime 对象的生存期]

Even if the interface of [classref boost::intrusive::list list] is similar to `std::list`, its usage is a bit different: You always have to keep in mind that you directly store objects in intrusive containers, not copies. The lifetime of a
-stored object is not bound to or managed by the container:
+stored object is not bound to or managed by the container:\n
+虽然 [classref boost::intrusive::list list] 的接口与 `std::list` 类似,但是 它的用法有些不一样: +你必须紧记你是直接将对象保存到介入式容器中,而不是其拷贝。被保存对象的生存 期未被绑定到容器,
+也不是由容器负责管理:

* When the container gets destroyed before the object, the object is not destroyed,
-   so you have to be careful to avoid resource leaks.
+   so you have to be careful to avoid resource leaks.\n
+ 如果容器在对象之前被销毁,则对象不会被销毁,因此你必须小心以防止资源泄 漏。

* When the object is destroyed before the container, your program is likely to crash,
-   because the container contains a pointer to an non-existing object.
+   because the container contains a pointer to an non-existing object.\n
+ 如果对象在容器之前被销毁,你的程序很可能会崩溃,因为容器中包含了一个指 针,指向不存在的对象。

 [endsect]

 [endsect]

-[section:usage_when When to use?]
+[section:usage_when When to use? 何时使用?]

Intrusive containers can be used for highly optimized algorithms, where speed is a crucial
-issue and:
-
-*  additional memory management should be avoided.
-* the programmer needs to efficiently track the construction and destruction of objects.
-*  exception safety, especially the no-throw guarantee, is needed.
+issue and:\n
+介入式容器可用于速度是关键问题的高度优化的算法,以及:
+
+*  additional memory management should be avoided.\n
+   要避免额外的内存管理。
+* the programmer needs to efficiently track the construction and destruction of objects.\n
+   程序员需要高效地跟踪对象的构造和析构。
+*  exception safety, especially the no-throw guarantee, is needed.\n
+   需要异常安全,尤其是无抛出保证。
 *  the computation of an iterator to an element from a pointer or reference
-   to that element should be a constant time operation.
-*  it's important to achieve a well-known worst-time system response.
-* localization of data (e.g. for cache hit optimization) leads to measurable effects.
+   to that element should be a constant time operation.\n
+   从某个元素的指针或引用得到该元素的迭代器的计算要求是常量时间的操作。
+*  it's important to achieve a well-known worst-time system response.\n
+   实现可预知的最坏系统响应时间是重要的。
+* localization of data (e.g. for cache hit optimization) leads to measurable effects.\n
+   数据局部性(例如,为了缓存命中优化)会导致可测量的影响。

The last point is important if you have a lot of containers over a set of elements. E.g. if you have a vector of objects (say, `std::vector<Object>`), and you also have a list storing a subset of those objects (`std::list<Object*>`), then operating on an Object
-from the list iterator (`std::list<Object*>::iterator`) requires two steps:
-
-* Access from the iterator (usually on the stack) to the list node storing a pointer to `Object`.
-*  Access from the pointer to `Object` to the Object stored in the vector.
+from the list iterator (`std::list<Object*>::iterator`) requires two steps:\n +如果你有多个容器建立在同一组元素之上,那么最后一点就很重要了。例如,如果你 有一组对象的 vector +(即 `std::vector<Object>`),而且你还有一个链表保存了这些对象的一个子集 (`std::list<Object*>`), +那么从这个链表的迭代器(`std::list<Object*>::iterator`)操作一个 Object 就需 要两步:
+
+* Access from the iterator (usually on the stack) to the list node storing a pointer to `Object`.\n
+   从迭代器(通常是在栈上)访问保存了 `Object` 指针的链表节点。
+* Access from the pointer to `Object` to the Object stored in the vector.\n
+   从 `Object` 指针访问保存在 vector 中的 Object。

 While the objects themselves are tightly packed in the memory of the vector
 (a vector's memory is guaranteed to be contiguous), and form something
@@ -480,11 +603,18 @@
Hence depending on your system you might get a lot of cache misses. The same doesn't hold for an intrusive list. Indeed, dereferencing an iterator from an intrusive list is performed in the same two steps as described above. But the list node is already embedded in the Object, so
-the memory is directly tracked from the iterator to the Object.
+the memory is directly tracked from the iterator to the Object. \n
+虽然这些对象本身是被紧紧地压缩在 vector 的内存中的(vector 的内存是保证连续 的), +形成了象一个数据块那样的东西,但是链表结点却可能分散在堆内存中。因此,取决 于你的系统,
+你可能会遇到大量的缓存失失败。对于介入式链表则不会这样。事实上,
+解引用一个来自于介入式链表的迭代器同样要执行以上两步。但是由于链表结点已经 被嵌入在 Object 中,
+所以访问 Object 迭代器时就直接留下了这些内存。

It's also possible to use intrusive containers when the objects to be stored can have different or unknown size. This allows storing base and derived objects
-in the same container, as shown in the following example:
+in the same container, as shown in the following example: \n
+当被保存的对象的大小未知或很难获知时,也可以使用介入式容器。
+它允许将基类对象和派生类对象保存在同一个容器中,示范如下:

 [import ../example/doc_window.cpp]
 [doc_window_code]
@@ -493,103 +623,144 @@
they are often more difficult to use than their STL-counterparts. That's why you should avoid them in public interfaces of libraries. Classes to be stored in intrusive containers must change their implementation to store the hook and this is not always
-possible or desirable.
+possible or desirable.\n
+由于介入式容器的特性,通常它们要比STL中的对应容器更难使用。所以你应该在库的 公有接口中避免使用它们。
+保存在介入式容器中的类必须修改其实现,以保存钩子,这并非总是可以或合理的。

 [endsect]

-[section:concepts_summary Concept summary]
+[section:concepts_summary Concept summary 概念摘要]

Here is a small summary of the basic concepts that will be used in the following
-chapters:
-
-[variablelist Brief Concepts Summary
-[[Node Algorithms][A class containing typedefs and static functions that define
+chapters:\n
+以下是对在后续章节中将要用到的一些基本概念的小结:
+
+[variablelist Brief Concepts Summary 主要概念摘要
+[[Node Algorithms 节点算法][A class containing typedefs and static functions that define basic operations that can be applied to a group of nodes. It's independent
    from the node definition and configured using a NodeTraits template
-   parameter that describes the node.]]
-[[Node Traits][A class that stores basic information and operations to insert a node into a group of nodes.]] -[[Hook][A class that a user must add as a base class or as a member to make the user class compatible with intrusive containers.]] -[[Intrusive Container][A class that stores user classes that have the needed hooks. It takes a ValueTraits template parameter as configuration information.]] -[[Semi-Intrusive Container][Similar to an intrusive container but a semi-intrusive container needs additional memory (e.g. an auxiliary array) to work.]] -[[Value Traits][A class containing typedefs and operations to obtain the node to be used by Node Algorithms from the user class and the inverse.]]
+   parameter that describes the node.\n
+ 一个包含了一些 typedef 和静态函数的类,定义了可应用于一组节点的一些基本 操作。 + 它独立于节点的定义,并且可以用一个描述该节点的 NodeTraits 模板参数来进行 配置。]] +[[Node Traits 节点Traits ][A class that stores basic information and operations to insert a node into a group of nodes.\n
+一个保存了基本信息和将节点插入到节点组中的操作的类。]]
+[[Hook 钩子][A class that a user must add as a base class or as a member to make the user class compatible with intrusive containers.\n +一个类,用户必须将它作为基类或作为成员加入到用户类中,使得用户类兼容于介入 式容器。]] +[[Intrusive Container 介入式容器][A class that stores user classes that have the needed hooks. It takes a ValueTraits template parameter as configuration information.\n +一个保存了具有所需钩子的用户类的类。它接受一个 ValueTraits 模板参数作为配置 信息。]] +[[Semi-Intrusive Container 半介入式容器][Similar to an intrusive container but a semi-intrusive container needs additional memory (e.g. an auxiliary array) to work.\n
+类似于介入式容器,但需要额外的内存(如一个辅助数组)才能工作。]]
+[[Value Traits 值Traits][A class containing typedefs and operations to obtain the node to be used by Node Algorithms from the user class and the inverse.\n +一个类,包含了一些 typedef 和从用户类获得由节点算法使用的节点的操作,以及相 反的操作。]]
 ]

 [endsect]

-[section:presenting_containers Presenting Boost.Intrusive containers]
-
-[*Boost.Intrusive] offers a wide range of intrusive containers:
+[section:presenting_containers Presenting Boost.Intrusive containers 介绍 Boost.Intrusive 容器]
+
+[*Boost.Intrusive] offers a wide range of intrusive containers:\n
+[*Boost.Intrusive] 提供了大量的介入式容器:

* [*slist]: An intrusive singly linked list. The size overhead is very small for user classes (usually the size of one pointer) but many operations have linear - time complexity, so the user must be careful if he wants to avoid performance problems. + time complexity, so the user must be careful if he wants to avoid performance problems.\n + [*slist]: 介入式的单链表。对于用户类的空间开销非常小(通常只有一个指针的 大小), + 但多数操作具有线性的时间复杂度,因此,如果用户想避免性能问题,就要小心使 用。

* [*list]: A `std::list` like intrusive linked list. The size overhead is quite small for user classes (usually the size of two pointers). Many operations have
-   constant time complexity.
+   constant time complexity.\n
+ [*list]: 一个类似于 `std::list` 的介入式链表。对于用户类的空间开销非常小 (通常只有两个指针的大小)。
+   多数操作具有线性的时间复杂度。

* [*set/multiset/rbtree]: `std::set/std::multiset` like intrusive associative containers
    based on red-black trees.
The size overhead is moderate for user classes (usually the size of three pointers).
-   Many operations have logarithmic time complexity.
+   Many operations have logarithmic time complexity.\n
+ [*set/multiset/rbtree]: 类似于 `std::set/std::multiset` 的介入式关联容 器,基于红黑树。 + 对于用户类的空间开销适中(通常为三个指针的大小)。多数操作具有对数时间复杂 度。

* [*avl_set/avl_multiset/avltree]: A `std::set/std::multiset` like intrusive associative
    containers based on AVL trees.
The size overhead is moderate for user classes (usually the size of three pointers).
-   Many operations have logarithmic time complexity.
+   Many operations have logarithmic time complexity.\n
+ [*avl_set/avl_multiset/avltree]: 类似于 `std::set/std::multiset` 的介入 式关联容器,基于 AVL 树。 + 对于用户类的空间开销适中(通常为三个指针的大小)。多数操作具有对数时间复杂 度。

* [*splay_set/splay_multiset/splaytree]: `std::set/std::multiset` like intrusive associative containers based on splay trees. Splay trees have no constant operations, but they
    have some interesting caching properties.
The size overhead is moderate for user classes (usually the size of three pointers).
-   Many operations have logarithmic time complexity.
+   Many operations have logarithmic time complexity.\n
+ [*splay_set/splay_multiset/splaytree]: 类似于 `std::set/std::multiset` 的介入式关联容器,基于 splay 树。 + splay 树不具有常量性的操作,不过它有一些有趣的缓存特性。对于用户类的空间 开销适中(通常为三个指针的大小)。
+   多数操作具有对数时间复杂度。

* [*sg_set/sg_multiset/sgtree]: A `std::set/std::multiset` like intrusive associative containers based on scapegoat trees. Scapegoat can be configured with the desired balance factor to achieve the desired rebalancing frequency/search time compromise. The size overhead is moderate for user classes (usually the size of three pointers).
-   Many operations have logarithmic time complexity.
-
-[*Boost.Intrusive] also offers semi-intrusive containers:
+   Many operations have logarithmic time complexity.\n
+ [*sg_set/sg_multiset/sgtree]: 类似于 `std::set/std::multiset` 的介入式关 联容器,基于 scapegoat 树。 + scapegoat 树可以按所期望的平衡因子来配置,以达到所希望的重新平衡频度和查 找时间之间的折衷。 + 对于用户类的空间开销适中(通常为三个指针的大小)。多数操作具有对数时间复杂 度。
+
+[*Boost.Intrusive] also offers semi-intrusive containers:\n
+[*Boost.Intrusive] 还提供了半介入式容器:

* [*unordered_set/unordered_multiset]: `std::tr1::unordered_set/std::tr1::unordered_multiset`
    like intrusive unordered associative containers.
The size overhead is moderate for user classes (an average of two pointers per element).
-   Many operations have amortized constant time complexity.
+   Many operations have amortized constant time complexity.\n
+ [*unordered_set/unordered_multiset]: 类似于 `std::tr1::unordered_set/std::tr1::unordered_multiset` + 的介入式无序关联容器。对于用户类的空间开销适中(平均为每个元素两个指针)。 多数操作具有分期常量时间复杂度。

Most of these intrusive containers can be configured with constant or linear time
-size:
+size:\n
+这些介入式容器中的多数可以被配置为带有常量时间复杂度或线性时间复杂度的 size 函数:

* [*Linear time size]: The intrusive container doesn't hold a size member that is updated with every insertion/erasure. This implies that the `size()` function doesn't have constant time complexity. On the other hand, the container is smaller, and some operations, like `splice()` taking a range of iterators in linked lists, have constant time complexity
-instead of linear complexity.
+instead of linear complexity.\n
+[*线性时间的 size]: 此类介入式容器不存在一个在每次插入/删除时更新的 size 成 员。这意味着 `size()` 函数不具有常量时间复杂度。 +另一方面,容器可以更小,而且某些操作,如接受一个在链表中的迭代器区间的 `splice()`,则具有常量时间复杂度而不是线性复杂度。

* [*Constant time size]: The intrusive container holds a size member that is updated with every insertion/erasure. This implies that the `size()` function has constant time complexity. On the other hand, increases the size of the container, and some operations, -like `splice()` taking a range of iterators, have linear time complexity in linked lists. +like `splice()` taking a range of iterators, have linear time complexity in linked lists.\n +[*常量时间的 size]: 此类介入式容器保存了一个在每次插入/删除时更新的 size 成 员。这意味着 `size()` 函数具有常量时间复杂度。 +另一方面,这增加了容器的大小,而且某些操作,如接受一个在链表中的迭代器区间 的 `splice()`,则具有线性复杂度。

To make user classes compatible with these intrusive containers [*Boost.Intrusive]
-offers two types of hooks for each container type:
-
-* [*Base hook]: The hook is stored as a public base class of the user class.
-
-*  [*Member hook]: The hook is stored as a public member of the user class.
-
-Apart from that, [*Boost.Intrusive] offers additional features:
+offers two types of hooks for each container type:\n
+为了让用户类兼容于这些介入式容器,[*Boost.Intrusive] 为每种容器类型提供了两 类钩子:
+
+* [*Base hook]: The hook is stored as a public base class of the user class.\n
+   [*基类钩子]:钩子被保存为用户的一个公有基类。
+
+* [*Member hook]: The hook is stored as a public member of the user class.\n
+   [*成员钩子]:钩子被保存为用户的一个公有成员。
+
+Apart from that, [*Boost.Intrusive] offers additional features:\n
+除此以外,[*Boost.Intrusive] 还提供了以下特性:

* [*Safe mode hooks]: Hook constructor initializes the internal data to a well-known safe state and intrusive containers check that state before inserting a value in the container. When erasing an element from the container, the container puts the hook in the safe state again. This allows a safer use mode and it can be used to detect programming errors. It implies a slight performance overhead in some operations
-   and can convert some constant time operations to linear time operations.
+ and can convert some constant time operations to linear time operations.\n + [*安全模式钩子]:钩子的构造函数将内部数据初始化为一种可知的安全状态,介 入式容器在插入一个值之前检查该状态。 + 从容器中删除一个元素时,容器再次将钩子置回安全状态。这样就允许了一种安全 的使用模式,它可以被用于检测程序的错误。 + 它意味着某些操作会有轻微的性能开销,也可能将一些常量时间的操作变为线性时 间。

* [*Auto-unlink hooks]: The hook destructor removes the object from the container automatically and the user can safely unlink the object from the container without
-   referring to the container.
+   referring to the container.\n
+ [*自断钩子]:钩子的析构函数自动将对象从容器中移除,用户无需知道容器就可 以安全地将对象从容器断开。

* [*Non-raw pointers]: If the user wants to use smart pointers instead of raw pointers,
    [*Boost.Intrusive] hooks can
@@ -598,68 +769,90 @@
    configured with these hooks will be smart pointers. As an example,
[*Boost.Interprocess] defines a smart pointer compatible with shared memory, called `offset_ptr`. [*Boost.Intrusive] can be configured to use this smart pointer
-   to allow shared memory intrusive containers.
+   to allow shared memory intrusive containers.\n
+ [*非裸指针]:如果用户想用智能指针代替裸指针,[*Boost.Intrusive] 钩子可以 被配置为使用任意类型的指针。 + 这一配置信息也被转送到容器,所以以这些钩子进行配置的介入式容器所使用的所 有内部指针都会是智能指针。 + 例如,[*Boost.Interprocess] 定义了一个兼容于共享内存的智能指针,名为 `offset_ptr`。 [*Boost.Intrusive]
+   可以被配置为使用此智能指针,就可以使用共享内存介入式容器。

 [endsect]

-[section:safe_hook Safe hooks]
-
-[section:features Features of the safe mode]
+[section:safe_hook Safe hooks 安全钩子]
+
+[section:features Features of the safe mode 安全模式的特点]

 [*Boost.Intrusive] hooks can be configured to operate in safe-link mode.
-The safe mode is activated by default, but it can be also explicitly activated: +The safe mode is activated by default, but it can be also explicitly activated:\n +[*Boost.Intrusive] 钩子可以被配置为以安全链接模式操作。安全模式缺省是激活 的,不过也可以明确激活:

 [c++]

    //Configuring the safe mode explicitly
+   //显式配置安全模式
    class Foo : public list_base_hook< link_mode<safe_link> >
    {};

 With the safe mode the user can detect if the object
-is actually inserted in a container without any external reference. Let's review the basic features of the safe mode:
-
-*  Hook's constructor puts the hook in a well-known default state.
+is actually inserted in a container without any external reference. Let's review the basic features of the safe mode:\n +通过使用安全模式,用户可以检测实际插入到容器中的对象是否没有任何外部引用。 我们来复习一下安全模式的基本特点:
+
+*  Hook's constructor puts the hook in a well-known default state.\n
+   钩子的构造函数将钩子置于一个可知的缺省状态。

* Hook's destructor checks if the hook is in the well-known default state. If not,
-   an assertion is raised.
+   an assertion is raised.\n
+   钩子的析构函数检查钩子是否处于缺省状态。如否,则引发断言。

* Every time an object is inserted in the intrusive container, the container
    checks if the hook is in the well-known default state. If not,
-   an assertion is raised.
+   an assertion is raised.\n
+ 每当有对象被插入到介入式容器中时,容器检查其钩子是否处于缺省状态。如 否,则引发断言。

* Every time an object is being erased from the intrusive container, the container
-   puts the erased object in the well-known default state.
+   puts the erased object in the well-known default state.\n
+   每当从介入式容器移除对象时,容器将被移除对象重置回缺省状态。

With these features, without any external reference the user can know if the object has been inserted in a container by calling the `is_linked()` member function.
 If the object is not actually inserted
in a container, the hook is in the default state, and if it is inserted in a container, the
-hook is not in the default state.
+hook is not in the default state.\n
+有了这些特性,无须任何外部引用,用户可以通过调用 `is_linked()` 成员函数就知 道对象是否已被插入到某个容器中。 +如果该对象未被实际插入到容器中,则其钩子处于缺省状态,如果它已被插入到容器 中,则其钩子就处于非缺省状态。

 [endsect]

-[section:configuring Configuring safe-mode assertions]
+[section:configuring Configuring safe-mode assertions 配置安全模式的断言]

 By default, all safe-mode assertions raised by [*Boost-Intrusive] hooks
and containers in are implemented using `BOOST_ASSERT`, which can be configured by
 the user. See [@http://www.boost.org/libs/utility/assert.html] for more
-information about `BOOST_ASSERT`.
+information about `BOOST_ASSERT`.\n
+缺省情况下,所有由 [*Boost-Intrusive] 钩子和容器引发的安全模式断言都是用 `BOOST_ASSERT` 实现的, +可以由用户配置。有关 `BOOST_ASSERT` 的更多信息请见 [@http://www.boost.org/libs/utility/assert.html]。;

 `BOOST_ASSERT` is globally configured, so the user might
want to redefine intrusive safe-mode assertions without modifying the global
-`BOOST_ASSERT`. This can be achieved redefining the following macros:
+`BOOST_ASSERT`. This can be achieved redefining the following macros:\n
+`BOOST_ASSERT` 是全局配置的,因此用户可能会想不修改全局的 `BOOST_ASSERT` 而 重新定义介入式安全模式的断言。
+这可以通过重定义以下宏来实现:

 *  `BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT`: This assertion will be
    used in insertion functions of the intrusive containers to check that
-   the hook of the value to be inserted is default constructed.
+   the hook of the value to be inserted is default constructed.\n
+ `BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT`: 该断言在介入式容器的插入函数 中被用于检查插入值的钩子是否缺省构造。
 *  `BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT`: This assertion will be
-   used in hooks' destructors to check that the hook is in a default state.
+ used in hooks' destructors to check that the hook is in a default state.\n + `BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT`: 该断言在钩子的析构函数中 被用于检查钩子是否处于缺省状态。

If any of these macros is not redefined, the assertion will default to `BOOST_ASSERT`. If `BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT` or `BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT` is defined and the programmer needs to include a file to configure that assertion, it can define `BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT_INCLUDE` or `BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT_INCLUDE`
-with the name of the file to include:
+with the name of the file to include:\n
+如果这两个宏的任何一个未重定义,则断言缺省为 `BOOST_ASSERT`。如果定义了 `BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT` +或 `BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT` 且程序员需要包含一个文件来 对断言进行配置,则可以定义带有该文件名的 +`BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT_INCLUDE` 或 `BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT_INCLUDE` 来包含:

 [c++]

@@ -670,64 +863,83 @@

 [endsect]

-[section:auto_unlink_hooks Auto-unlink hooks]
-
-[section:auto_unlink_hooks_what What's an auto-unlink hook?]
-
-[*Boost.Intrusive] offers additional hooks with unique features:
+[section:auto_unlink_hooks Auto-unlink hooks 自断钩子]
+
+[section:auto_unlink_hooks_what What's an auto-unlink hook? 什么是自断钩 子?]
+
+[*Boost.Intrusive] offers additional hooks with unique features:\n
+[*Boost.Intrusive] 提供了其它具有特色的钩子:

* When the destructor of the hook is called, the hook checks if the node is inserted
-   in a container. If so, the hook removes the node from the container.
+   in a container. If so, the hook removes the node from the container.\n
+ 当钩子的析构函数被调用时,钩子会检查该节点是否已被插入到某个容器中。如果 是,则钩子将节点从容器中移除。 * The hook has a member function called `unlink()` that can be used to unlink the node from the container at any time, without having any reference to the container,
-   if the user wants to do so.
+   if the user wants to do so.\n
+ 钩子具有一个名为 `unlink()` 的成员函数,它可用于随时将节点从容器移除,而 无需具有到容器的引用,
+   如果用户想这样做的话。

These hooks have exactly the same size overhead as their analog non auto-unlinking
 hooks, but they have a restriction: they can only be used with
 [link intrusive.presenting_containers non-constant time containers].
-There is a reason for this:
-
-* Auto-unlink hooks don't store any reference to the container where they are inserted.
+There is a reason for this: \n
+这些钩子与非自断钩子具有完全相同的空间开销,但是它们有一个限制:它们只能用
+[link intrusive.presenting_containers 非常量时间的容器]。这是因为:
+
+* Auto-unlink hooks don't store any reference to the container where they are inserted.\n
+  自断钩子并没有保存任何到它们所插入的容器的引用。
* Only containers with non constant-time `size()` allow removing an object from the container
-  without referring to the container.
+  without referring to the container. \n
+ 只有带有非常量时间 `size()` 的容器允许无需知道容器就可以从容器中移除一个 对象。

***The diff for this file has been truncated for email.***
=======================================
--- /trunk/libs/lambda/doc/lambda.xml   Mon Dec 28 23:05:14 2009
+++ /trunk/libs/lambda/doc/lambda.xml   Mon Jan 11 23:29:12 2010
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-Latin-1"?>
+<?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
   "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd";>
 <library name="Lambda" dirname="lambda" id="lambda"
@@ -7,7 +7,7 @@
 <libraryinfo>
   <author>
     <firstname>Jaakko</firstname>
-    <surname>Järvi</surname>
+    <surname>J鋜vi</surname>
      <email>jarvi at cs tamu edu</email>
   </author>

@@ -18,7 +18,7 @@
     <year>2002</year>
     <year>2003</year>
     <year>2004</year>
-    <holder>Jaakko Järvi</holder>
+    <holder>Jaakko J鋜vi</holder>
     <holder>Gary Powell</holder>
   </copyright>

@@ -39,7 +39,7 @@

   <section id="introduction">

-    <title>In a nutshell</title>
+    <title>In a nutshell 概述</title>

     <para>

@@ -50,7 +50,11 @@
convenient means to define unnamed function objects for STL algorithms. In explaining what the library is about, a line of code says more than a thousand words; the
       following line outputs the elements of some STL container
-      <literal>a</literal> separated by spaces:
+      <literal>a</literal> separated by spaces:<sbr/>
+ Boost Lambda Library(简称为 BLL)是一个 C++ 模板库,为 C++ 实现了 <emphasis>lambda abstractions</emphasis> + 的形式。这个术语起源于函数式编程和 lambda 演算,一个 lambda abstraction 定义一个无名函数。 + BLL 的主要动机是为定义供 STL 算法使用的无名函数对象提供灵活性和便利 性。在讲解一个库是什么的时候, + 一行代码往往胜过千言万语,下面这一行输出以空格分隔的某个 STL 容器 <literal>a</literal> 中的元素:

<programlisting><![CDATA[for_each(a.begin(), a.end(), std::cout << _1 << ' ');]]></programlisting>

@@ -58,111 +62,150 @@
The variable <literal>_1</literal> is the parameter of this function, a <emphasis>placeholder</emphasis> for the actual argument.
       Within each iteration of <literal>for_each</literal>, the function is
called with an element of <literal>a</literal> as the actual argument. - This actual argument is substituted for the placeholder, and the <quote>body</quote> of the function is evaluated. + This actual argument is substituted for the placeholder, and the <quote>body</quote> of the function is evaluated.<sbr/> + 表达式 <literal><![CDATA[std::cout << _1 << ' ']]></literal> 定义了一 个一元的函数对象。变量 <literal>_1</literal> + 是这个函数的形式参数,相当于一个实际参数的 <emphasis>占位符 </emphasis>。在 <literal>for_each</literal> + 的每一次迭代中,针对实际参数 <literal>a</literal> 中的元素调用这个函 数。这个实际参数取代了占位符,
+      而这个函数<quote>体</quote>被求值。
     </para>

- <para>The essence of BLL is letting you define small unnamed function objects, such as the one above, directly on the call site of an STL algorithm. + <para>The essence of BLL is letting you define small unnamed function objects, such as the one above, directly on the call site of an STL algorithm.<sbr/> + BLL 的本质是让你就像上面那个一样,在紧挨着 STL 算法调用位置的上面,定义 小的无名函数对象。
     </para>
   </section>

   <section id="lambda.getting_started">
-    <title>Getting Started</title>
+    <title>Getting Started 起步</title>

     <section>
-      <title>Installing the library</title>
+      <title>Installing the library 库的安装</title>


       <para>
        The library consists of include files only, hence there is no
        installation procedure. The <literal>boost</literal> include directory
        must be on the include path.
-       There are a number of include files that give different functionality:
-
-       <!-- TODO: tarkista vielä riippuvuudet-->
+ There are a number of include files that give different functionality:<sbr/> + 这个库仅由 include 文件组成,因此不需要安装过程。 <literal>boost</literal> 的 + include 目录必须加入到 include 路径中。有许多 include 文件提供了不同的 功能:
+
+       <!-- TODO: tarkista viel?riippuvuudet-->
        <itemizedlist>

          <listitem><para>
<filename>lambda/lambda.hpp</filename> defines lambda expressions for different C++
-             operators, see <xref linkend="lambda.operator_expressions"/>.
+             operators, see <xref 
linkend="lambda.operator_expressions"/>.<sbr/>
+ <filename>lambda/lambda.hpp</filename> 为不同的 C++ 操作符定义了 lambda 表达式,
+          参见 <xref linkend="lambda.operator_expressions"/> 。
            </para></listitem>

          <listitem><para>
- <filename>lambda/bind.hpp</filename> defines <literal>bind</literal> functions for up to 9 arguments, see <xref linkend="lambda.bind_expressions"/>.</para></listitem> + <filename>lambda/bind.hpp</filename> defines <literal>bind</literal> functions for up to 9 arguments, see <xref linkend="lambda.bind_expressions"/>.<sbr/> + <filename>lambda/bind.hpp</filename> 为最多 9 个参数定义了 <literal>bind</literal> 表达式, + 参见 <xref linkend="lambda.bind_expressions"/> 。 </para></listitem>


          <listitem><para>
- <filename>lambda/if.hpp</filename> defines lambda function equivalents for if statements and the conditional operator, see <xref linkend="lambda.lambda_expressions_for_control_structures"/> (includes <filename>lambda.hpp</filename>). + <filename>lambda/if.hpp</filename> defines lambda function equivalents for if statements and the conditional operator, see <xref linkend="lambda.lambda_expressions_for_control_structures"/> (includes <filename>lambda.hpp</filename>).<sbr/> + <filename>lambda/if.hpp</filename> 定义了相当于 if 语句和条件操作 符的 lambda 函数, + 参见 <xref linkend="lambda.lambda_expressions_for_control_structures"/> (包括 <filename>lambda.hpp</filename>)。
            </para></listitem>

          <listitem><para>
- <filename>lambda/loops.hpp</filename> defines lambda function equivalent for looping constructs, see <xref linkend="lambda.lambda_expressions_for_control_structures"/>. + <filename>lambda/loops.hpp</filename> defines lambda function equivalent for looping constructs, see <xref linkend="lambda.lambda_expressions_for_control_structures"/>.<sbr/> + <filename>lambda/loops.hpp</filename> 定义了相当于循环结构的 lambda 函数,参见 + <xref linkend="lambda.lambda_expressions_for_control_structures"/> 。
            </para></listitem>

          <listitem><para>
- <filename>lambda/switch.hpp</filename> defines lambda function equivalent for the switch statement, see <xref linkend="lambda.lambda_expressions_for_control_structures"/>. + <filename>lambda/switch.hpp</filename> defines lambda function equivalent for the switch statement, see <xref linkend="lambda.lambda_expressions_for_control_structures"/>.<sbr/> + <filename>lambda/switch.hpp</filename> 定义了相当于 switch 语句 的 lambda 函数,参见 + <xref linkend="lambda.lambda_expressions_for_control_structures"/> 。
            </para></listitem>

          <listitem><para>
- <filename>lambda/construct.hpp</filename> provides tools for writing lambda expressions with constructor, destructor, new and delete invocations, see <xref linkend="lambda.construction_and_destruction"/> (includes <filename>lambda.hpp</filename>). + <filename>lambda/construct.hpp</filename> provides tools for writing lambda expressions with constructor, destructor, new and delete invocations, see <xref linkend="lambda.construction_and_destruction"/> (includes <filename>lambda.hpp</filename>).<sbr/> + <filename>lambda/construct.hpp</filename> 提供了用于写带有构造函 数,析构函数,new 和 delete 调用的 lambda 表达式的工具, + 参见 <xref linkend="lambda.construction_and_destruction"/> (包 括 <filename>lambda.hpp</filename>)。
            </para></listitem>

          <listitem><para>
- <filename>lambda/casts.hpp</filename> provides lambda versions of different casts, as well as <literal>sizeof</literal> and <literal>typeid</literal>, see <xref linkend="lambda.cast_expressions"/>. + <filename>lambda/casts.hpp</filename> provides lambda versions of different casts, as well as <literal>sizeof</literal> and <literal>typeid</literal>, see <xref linkend="lambda.cast_expressions"/>.<sbr/> + <filename>lambda/casts.hpp</filename> 提供了各种强制转型以及 <literal>sizeof</literal> 和 + <literal>typeid</literal> 的 lambda 版本,参见 <xref linkend="lambda.cast_expressions"/> 。
            </para></listitem>

          <listitem><para>
<filename>lambda/exceptions.hpp</filename> gives tools for throwing and catching exceptions within lambda functions, <xref linkend="lambda.exceptions"/> (includes
-             <filename>lambda.hpp</filename>).
+             <filename>lambda.hpp</filename>).<sbr/>
+ <filename>lambda/exceptions.hpp</filename> 给出了在 lambda 函数中 抛出和捕获异常的工具, + 参见 <xref linkend="lambda.exceptions"/> (包括 <filename>lambda.hpp</filename>)。
            </para></listitem>

          <listitem><para>
- <filename>lambda/algorithm.hpp</filename> and <filename>lambda/numeric.hpp</filename> (cf. standard <filename>algortihm</filename> and <filename>numeric</filename> headers) allow nested STL algorithm invocations, see <xref linkend="lambda.nested_stl_algorithms"/>. + <filename>lambda/algorithm.hpp</filename> and <filename>lambda/numeric.hpp</filename> (cf. standard <filename>algortihm</filename> and <filename>numeric</filename> headers) allow nested STL algorithm invocations, see <xref linkend="lambda.nested_stl_algorithms"/>.<sbr/> + <filename>lambda/algorithm.hpp</filename> 和 <filename>lambda/numeric.hpp</filename>(与标准 + <filename>algortihm</filename> 和 <filename>numeric</filename> 头 文件相对)允许嵌入 STL 算法调用,
+          参见 <xref linkend="lambda.nested_stl_algorithms"/> 。
            </para></listitem>

        </itemizedlist>

        Any other header files in the package are for internal use.
        Additionally, the library depends on two other Boost Libraries, the
- <emphasis>Tuple</emphasis> <xref linkend="cit:boost::tuple"/> and the <emphasis>type_traits</emphasis> <xref linkend="cit:boost::type_traits"/> libraries, and on the <filename>boost/ref.hpp</filename> header. + <emphasis>Tuple</emphasis> <xref linkend="cit:boost::tuple"/> and the <emphasis>type_traits</emphasis> <xref linkend="cit:boost::type_traits"/> libraries, and on the <filename>boost/ref.hpp</filename> header.<sbr/> + 其它一些包中的头文件是内部使用的。另外,这个库依赖于另外两个 Boost 库,<emphasis>Tuple</emphasis> + <xref linkend="cit:boost::tuple"/> 和 <emphasis>type_traits</emphasis> <xref linkend="cit:boost::type_traits"/> 库,
+    还有 <filename>boost/ref.hpp</filename> 头文件。
       </para>

       <para>
- All definitions are placed in the namespace <literal>boost::lambda</literal> and its subnamespaces. + All definitions are placed in the namespace <literal>boost::lambda</literal> and its subnamespaces.<sbr/> + 所有的定义都位于名字空间 <literal>boost::lambda</literal> 和它的子名字 空间中。
       </para>

     </section>

     <section>
-      <title>Conventions used in this document</title>
+      <title>Conventions used in this document 此文档中用到的约定</title>

<para>In most code examples, we omit the namespace prefixes for names in the <literal moreinfo="none">std</literal> and <literal moreinfo="none">boost::lambda</literal> namespaces.
-Implicit using declarations
+Implicit using declarations<sbr/>
+ 在大多数代码示例中,我们省略了那些位于名字空间 <literal moreinfo="none">std</literal> 和 + <literal moreinfo="none">boost::lambda</literal> 中的名字的名字空间前 缀。缺省 using 声明
 <programlisting>
 using namespace std;
 using namespace boost::lambda;
 </programlisting>
-are assumed to be in effect.
+are assumed to be in effect.<sbr/>
+被假定为有效。
 </para>

     </section>
   </section>

   <section>
-    <title>Introduction</title>
+    <title>Introduction 简介</title>

     <section>
-      <title>Motivation</title>
+      <title>Motivation 动机</title>
       <para>The Standard Template Library (STL)
<xref role="citation" linkend="cit:stepanov:94"/>, now part of the C++ Standard Library <xref role="citation" linkend="cit:c++:98"/>, is a generic container and algorithm library. -Typically STL algorithms operate on container elements via <emphasis>function objects</emphasis>. These function objects are passed as arguments to the algorithms. +Typically STL algorithms operate on container elements via <emphasis>function objects</emphasis>. These function objects are passed as arguments to the algorithms.<sbr/> + 标准模板库 (STL) <xref role="citation" linkend="cit:stepanov:94"/>,现 在是 C++ 标准库 + [<xref role="citation" linkend="cit:c++:98"/>] 的一部分,是一个泛型容器 和算法库。通常, + STL 算法通过 <emphasis>函数对象</emphasis>操作容器元素。这些函数对象作 为参数传递给算法。
 </para>

 <para>
 Any C++ construct that can be called with the function call syntax
 is a function object.
The STL contains predefined function objects for some common cases (such as <literal>plus</literal>, <literal>less</literal> and <literal>not1</literal>). -As an example, one possible implementation for the standard <literal>plus</literal> template is: +As an example, one possible implementation for the standard <literal>plus</literal> template is:<sbr/> +能够用函数调用语法调用的任何 C++ 结构都是一个函数对象。STL 容器为一些通常情 况定义了一些预定义的函数对象 +(比如 <literal>plus</literal>, <literal>less</literal> 和 <literal>not1</literal>)。
+例如,这是标准 <literal>plus</literal> 模板的一种可能的实现:

 <programlisting>
 <![CDATA[template <class T>
@@ -173,13 +216,18 @@
 };]]>
 </programlisting>

-The base class <literal><![CDATA[binary_function<T, T, T>]]></literal> contains typedefs for the argument and return types of the function object, which are needed to make the function object <emphasis>adaptable</emphasis>. +The base class <literal><![CDATA[binary_function<T, T, T>]]></literal> contains typedefs for the argument and return types of the function object, which are needed to make the function object <emphasis>adaptable</emphasis>.<sbr/> +基类 <literal><![CDATA[binary_function<T, T, T>]]></literal> 包含了函数对象 的参数和返回值类型的 typedefs,
+这些是让这个函数对象成为 <emphasis>可适配的</emphasis> 的需要。
 </para>

 <para>
 In addition to the basic function object classes, such as the one above,
the STL contains <emphasis>binder</emphasis> templates for creating a unary function object from an adaptable binary function object by fixing one of the arguments to a constant value. -For example, instead of having to explicitly write a function object class like: +For example, instead of having to explicitly write a function object class like:<sbr/> +除了像上面那个一样的基本函数对象类之外,还有 STL 容器 <emphasis>绑定器 </emphasis> 模板, +可以用来将一个可适配的二元函数对象通过将其中一个参数修改为一个常数而创建一 个一元函数对象。
+例如,为了替代像下面这样不得不显式写出的函数对象类:

 <programlisting>
 <![CDATA[class plus_1 {
@@ -192,7 +240,10 @@

the equivalent functionality can be achieved with the <literal moreinfo="none">plus</literal> template and one of the binder templates (<literal moreinfo="none">bind1st</literal>). E.g., the following two expressions create function objects with identical functionalities; -when invoked, both return the result of adding <literal moreinfo="none">1</literal> to the argument of the function object: +when invoked, both return the result of adding <literal moreinfo="none">1</literal> to the argument of the function object:<sbr/> +使用 <literal moreinfo="none">plus</literal> 模板和绑定器模板之一 (<literal moreinfo="none">bind1st</literal>) +也能得到等价的功能。例如,下面两个表达式创建了功能相同的函数对象,在调用的 时候, +都会返回在函数对象的参数上加 <literal moreinfo="none">1</literal> 之后的结 果:

 <programlisting>
 <![CDATA[plus_1(1)
@@ -200,7 +251,11 @@
 </programlisting>

The subexpression <literal><![CDATA[plus<int>()]]></literal> in the latter line is a binary function object which computes the sum of two integers, and <literal>bind1st</literal> invokes this function object partially binding the first argument to <literal>1</literal>. -As an example of using the above function object, the following code adds <literal>1</literal> to each element of some container <literal>a</literal> and outputs the results into the standard output stream <literal>cout</literal>. +As an example of using the above function object, the following code adds <literal>1</literal> to each element of some container <literal>a</literal> and outputs the results into the standard output stream <literal>cout</literal>.<sbr/> +上面最后一行中的子表达式 <literal><![CDATA[plus<int>()]]></literal> 是一个 计算两个整数之和的二元函数对象, +而 <literal>bind1st</literal> 调用这个函数对象,将第一个参数部分绑定为 <literal>1</literal>。 +作为使用上面的函数对象的一个示例,下面的代码在某个容器 <literal>a</literal> 的每一个元素上加 <literal>1</literal>,
+并且将结果输出到标准输出流 <literal>cout</literal> 中。

 <programlisting>
 <![CDATA[transform(a.begin(), a.end(), ostream_iterator<int>(cout),
@@ -215,7 +270,9 @@
 adaptable.

Finally, some STL implementations contain function composition operations as
-extensions to the standard <xref linkend="cit:sgi:02"/>.
+extensions to the standard <xref linkend="cit:sgi:02"/>.<sbr/>
+为了让绑定器模板更加通用,STL 包含了 <emphasis>适配器</emphasis>,它可以使 指向函数的指针或引用和指向成员函数的指针可以被适配。 +最终,作为对标准的扩展,某些 STL 实现包含了函数合成操作 <xref linkend="cit:sgi:02"/>。
       </para>

 <para>
@@ -233,25 +290,33 @@
 In addition to this, there are significant restrictions in applying
 the standard tools. E.g. the standard binders allow only one argument
 of a binary function to be bound; there are no binders for
-3-ary, 4-ary etc. functions.
+3-ary, 4-ary etc. functions. <sbr/>
+所有这些工具都指向一个目标:让“在一个 STL 算法的调用中指定 <emphasis>无名函 数</emphasis>”成为可能, +换句话说,就是将代码片段作为一个参数传递给一个函数。然而,这个目标只实现了 一部分。 +上面的简单示例展示了使用标准工具的无名函数定义是如何的麻烦。调用仿函数,适 配器, +绑定器和函数合成操作的复杂表达式越来越难以理解。除此之外,应用标准工具也有 很大的限制。 +例如,标准绑定器只允许绑定一个二元函数的一个参数,而且也没有三元,四元等等 函数的绑定器。
 </para>

 <para>
-The Boost Lambda Library provides solutions for the problems described above: +The Boost Lambda Library provides solutions for the problems described above:<sbr/>
+Boost Lambda 库为上面描述的问题提供了解决方案:

 <itemizedlist>
 <listitem>
 <para>
 Unnamed functions can be created easily with an intuitive syntax.

-The above example can be written as:
+The above example can be written as:<sbr/>
+无名函数能够通过符合直觉的语法简单地创建。上面的示例可以被写为:

 <programlisting>
 <![CDATA[transform(a.begin(), a.end(), ostream_iterator<int>(cout),
           1 + _1);]]>
 </programlisting>

-or even more intuitively:
+or even more intuitively:<sbr/>
+或者更符合直觉的:

 <programlisting>
 <![CDATA[for_each(a.begin(), a.end(), cout << (1 + _1));]]>
@@ -263,14 +328,16 @@
 <listitem>
 <para>
 Most of the restrictions in argument binding are removed,
-arbitrary arguments of practically any C++ function can be bound.
+arbitrary arguments of practically any C++ function can be bound.<sbr/>
+消除了参数绑定的大多数限制,几乎任何 C++ 函数的任意参数都能被绑定。
 </para>
 </listitem>

 <listitem>
 <para>
 Separate function composition operations are not needed,
-as function composition is supported implicitly.
+as function composition is supported implicitly.<sbr/>
+不再需要单独的函数合成操作,因为函数合成已被隐含支持。

 </para>
 </listitem>
@@ -284,11 +351,13 @@


 <section>
-      <title>Introduction to lambda expressions</title>
+      <title>Introduction to lambda expressions 简介lambda表达式</title>

       <para>
        Lambda expression are common in functional programming languages.
- Their syntax varies between languages (and between different forms of lambda calculus), but the basic form of a lambda expressions is: + Their syntax varies between languages (and between different forms of lambda calculus), but the basic form of a lambda expressions is:<sbr/> + lambda 表达式在函数式编程语言中很普通。在不同的语言之间(以及不同的 lambda 演算形式之间)语法有所区别,
+    但是一个 lambda 表达式的基本形式如下:


 <programlisting>
@@ -296,25 +365,30 @@
 </programlisting>
        <!-- $\lambda x_1 \cdots x_n . e$ -->

-       A lambda expression defines an unnamed function and consists of:
+       A lambda expression defines an unnamed function and consists of:<sbr/>
+    一个 lambda 表达式定义一个无名函数,并由以下部分组成:
        <itemizedlist>
          <listitem>
            <para>
- the parameters of this function: <literal>x<subscript>1</subscript> ... x<subscript>n</subscript></literal>. + the parameters of this function: <literal>x<subscript>1</subscript> ... x<subscript>n</subscript></literal>.<sbr/> + 这个函数的参数:<literal>x<subscript>1</subscript> ... x<subscript>n</subscript></literal>。
              <!--$x_1 \cdots x_n$-->
            </para>
          </listitem>
          <listitem>
- <para>the expression e which computes the value of the function in terms of the parameters <literal>x<subscript>1</subscript> ... x<subscript>n</subscript></literal>. + <para>the expression e which computes the value of the function in terms of the parameters <literal>x<subscript>1</subscript> ... x<subscript>n</subscript></literal>.<sbr/> + 表达式 e,这就是根据参数 <literal>x<subscript>1</subscript> ... x<subscript>n</subscript></literal> 要求其值的那个函数。
            </para>
          </listitem>
        </itemizedlist>

-       A simple example of a lambda expression is
+       A simple example of a lambda expression is <sbr/>
+    一个简单的 lambda 表达式示例如下:
 <programlisting>
 lambda x y.x+y
 </programlisting>
-Applying the lambda function means substituting the formal parameters with the actual arguments: +Applying the lambda function means substituting the formal parameters with the actual arguments:<sbr/>
+应用 lambda 函数意味着用实际参数取代形式参数:
 <programlisting>
 (lambda x y.x+y) 2 3 = 2 + 3 = 5
 </programlisting>
@@ -331,9 +405,14 @@
 They refer to the first, second and third argument of the function defined
 by the lambda expression.

-For example, the C++ version of the definition
+For example, the C++ version of the definition<sbr/>
+在 lambda 表达式的 C++ 版本中,缺少 <literal>lambda x<subscript>1</subscript> ... x<subscript>n</subscript></literal> 部分, +而且形式参数有预定义的名字。在库的当前版本中,有三个这样的预定义形式参 数,称为 <emphasis>占位符</emphasis>: +<literal>_1</literal>, <literal>_2</literal> 和 <literal>_3</literal>。它们 分别与通过 lambda 表达式定义的函数的第一个,
+第二个和第三个参数相关,例如,定义
 <programlisting>lambda x y.x+y</programlisting>
-is
+is <sbr/>
+的 C++ 版本为
 <programlisting>_1 + _2</programlisting>
 </para>

@@ -344,32 +423,39 @@
Lambda expressions containing function calls, control structures, casts etc. require special syntactic constructs. Most importantly, function calls need to be wrapped inside a <literal>bind</literal> function.

-       As an example, consider the lambda expression:
+       As an example, consider the lambda expression:<sbr/>
+ 因此,C++ lambda 表达式没有专门的句法关键字。作为一个操作数使用的占位符 暗示这个操作符调用是一个 lambda 表达式。 + 然而,也仅仅对于操作符调用来说这是真的。lambda 表达式包含的函数调用,控 制结构,强制转型等都需要特殊的语法结构。 + 最重要的是,函数调用需要被包装在一个 <literal>bind</literal> 函数之内。 例如,考虑这个 lambda 表达式:

        <programlisting>lambda x y.foo(x,y)</programlisting>

- Rather than <literal>foo(_1, _2)</literal>, the C++ counterpart for this expression is: + Rather than <literal>foo(_1, _2)</literal>, the C++ counterpart for this expression is:<sbr/> + 这个 lambda 表达式的 C++ 对等物不是 <literal>foo(_1, _2)</literal>,而 是:

        <programlisting>bind(foo, _1, _2)</programlisting>

- We refer to this type of C++ lambda expressions as <emphasis>bind expressions</emphasis>. + We refer to this type of C++ lambda expressions as <emphasis>bind expressions</emphasis>. <sbr/> + 我们将这种类型的 C++ lambda 表达式称为 <emphasis>bind 表达式 </emphasis>。
       </para>

- <para>A lambda expression defines a C++ function object, hence function application syntax is like calling any other function object, for instance: <literal>(_1 + _2)(i, j)</literal>.
-
-
+ <para>A lambda expression defines a C++ function object, hence function application syntax is like calling any other function object, for instance: <literal>(_1 + _2)(i, j)</literal>.<sbr/> + 一个 lambda 表达式定义一个函数对象,因此函数应用语法就像调用任何其它 的函数对象,例如:<literal>(_1 + _2)(i, j)</literal>。
       </para>



 <section id="lambda.partial_function_application">
-<title>Partial function application</title>
+<title>Partial function application 部分函数应用</title>

 <para>
A bind expression is in effect a <emphasis>partial function application</emphasis>. In partial function application, some of the arguments of a function are bound to fixed values.
          The result is another function, with possibly fewer arguments.
- When called with the unbound arguments, this new function invokes the original function with the merged argument list of bound and unbound arguments. + When called with the unbound arguments, this new function invokes the original function with the merged argument list of bound and unbound arguments.<sbr/> + 一个 bind 表达式本质上就是一个 <emphasis>部分函数应用</emphasis>。在 部分函数应用中, + 一个函数的某些参数被绑定到固定的值。结果是另一个函数,可能还带有更多 的参数。 + 当使用未绑定参数调用它的时候,这个新的函数合并绑定和未绑定参数的参数 列表并调用原始函数。
        </para>

<!-- <para>The underlying implementation of the BLL unifies the two types of lambda expressions (bind expressions and lambda expressions consisting of operator calls).
@@ -383,11 +469,14 @@


       <section id="lambda.terminology">
-       <title>Terminology</title>
+       <title>Terminology 术语</title>

        <para>
A lambda expression defines a function. A C++ lambda expression concretely constructs a function object, <emphasis>a functor</emphasis>, when evaluated. We use the name <emphasis>lambda functor</emphasis> to refer to such a function object. - Hence, in the terminology adopted here, the result of evaluating a lambda expression is a lambda functor. + Hence, in the terminology adopted here, the result of evaluating a lambda expression is a lambda functor.<sbr/> + 一个 lambda 表达式定义一个函数。在求值的时候,一个 C++ lambda 表达式 实际上构造了一个函数对象, + 一个 <emphasis>仿函数</emphasis>。我们用名字 <emphasis>lambda 仿函数 </emphasis> 来指涉这样一个函数对象。 + 因此,在此采纳的术语中,一个 lambda 表达式的求值结果是一个 lambda 仿 函数。
        </para>

       </section>
@@ -399,53 +488,67 @@
   </section>

   <section id = "lambda.using_library">
-    <title>Using the library</title>
+    <title>Using the library 库的使用</title>

     <para>
The purpose of this section is to introduce the basic functionality of the library. -There are quite a lot of exceptions and special cases, but discussion of them is postponed until later sections. +There are quite a lot of exceptions and special cases, but discussion of them is postponed until later sections.<sbr/> +这一部分的目标是介绍库的基本功能。库中有大量的例外和特殊情况,但我们到以后 的章节再讨论它们。


     </para>

     <section id = "lambda.introductory_examples">
-      <title>Introductory Examples</title>
+      <title>Introductory Examples 介绍性示例</title>

       <para>
In this section we give basic examples of using BLL lambda expressions in STL algorithm invocations.
        We start with some simple expressions and work up.
- First, we initialize the elements of a container, say, a <literal>list</literal>, to the value <literal>1</literal>: + First, we initialize the elements of a container, say, a <literal>list</literal>, to the value <literal>1</literal>:<sbr/> + 本节中我们给出在 STL 算法调用中使用 BLL lambda 表达式的基础示例。我们以 一些简单的表达式开始并逐步发展。 + 首先,我们初始化一个容器的元素,比方说,一个 <literal>list</literal>,设为值 <literal>1</literal>:


        <programlisting>
 <![CDATA[list<int> v(10);
 for_each(v.begin(), v.end(), _1 = 1);]]></programlisting>

- The expression <literal>_1 = 1</literal> creates a lambda functor which assigns the value <literal>1</literal> to every element in <literal>v</literal>.<footnote> + The expression <literal>_1 = 1</literal> creates a lambda functor which assigns the value <literal>1</literal> to every element in <literal>v</literal>.<sbr/> + 表达式 <literal>_1 = 1</literal> 创建一个 lambda 仿函数,它将 <literal>v</literal> 中的每一元素赋值为 <literal>1</literal>。<footnote>
 <para>
Strictly taken, the C++ standard defines <literal>for_each</literal> as a <emphasis>non-modifying sequence operation</emphasis>, and the function object passed to <literal moreinfo="none">for_each</literal> should not modify its argument. The requirements for the arguments of <literal>for_each</literal> are unnecessary strict, since as long as the iterators are <emphasis>mutable</emphasis>, <literal>for_each</literal> accepts a function object that can have side-effects on their argument. -Nevertheless, it is straightforward to provide another function template with the functionality of<literal>std::for_each</literal> but more fine-grained requirements for its arguments. +Nevertheless, it is straightforward to provide another function template with the functionality of<literal>std::for_each</literal> but more fine-grained requirements for its arguments.<sbr/> +严格地说,C++ 标准将 <literal>for_each</literal> 定义为一个 <emphasis>不变 序列操作</emphasis>,而传给 +<literal moreinfo="none">for_each</literal> 的函数对象不应该改变它的参数。 其实对 <literal>for_each</literal> +的参数的要求不必那么严格,因为只要迭代器是 <emphasis>可变化 </emphasis>的,<literal>for_each</literal> +也可以接受能够对它们的参数产生副作用的函数对象。不过,它只是直截了当地提供 一个其它带有 <literal>std::for_each</literal>
+的功能的函数模板,只不过它对它的参数没有那么细致的要求。
 </para>
 </footnote>
       </para>

       <para>
- Next, we create a container of pointers and make them point to the elements in the first container <literal>v</literal>: + Next, we create a container of pointers and make them point to the elements in the first container <literal>v</literal>:<sbr/> + 接下来,我们创建一个指针的容器,并让它们指向第一个容器 <literal>v</literal> 中的元素:

        <programlisting>
 <![CDATA[vector<int*> vp(10);
 transform(v.begin(), v.end(), vp.begin(), &_1);]]></programlisting>

The expression <literal><![CDATA[&_1]]></literal> creates a function object for getting the address of each element in <literal>v</literal>. -The addresses get assigned to the corresponding elements in <literal>vp</literal>. +The addresses get assigned to the corresponding elements in <literal>vp</literal>.<sbr/> +表达式 <literal><![CDATA[&_1]]></literal> 创建一个取得 <literal>v</literal> 中每一个元素的地址的函数对象。
+这些地址赋值给 <literal>vp</literal> 中的对应元素。
       </para>

       <para>
        The next code fragment changes the values in <literal>v</literal>.
        For each element, the function <literal>foo</literal> is called.
The original value of the element is passed as an argument to <literal>foo</literal>.
-The result of <literal>foo</literal> is assigned back to the element:
+The result of <literal>foo</literal> is assigned back to the element:<sbr/>
+下一个代码片段改变 <literal>v</literal> 中的值。对于每一个元素,函数 <literal>foo</literal> 被调用。 +元素的原始值作为一个参数被传送给 <literal>foo</literal>。 <literal>foo</literal> 的结果被赋回给那个元素:


        <programlisting>
@@ -455,15 +558,18 @@


       <para>
-       The next step is to sort the elements of <literal>vp</literal>:
+       The next step is to sort the elements of <literal>vp</literal>:<sbr/>
+    下一步是为 <literal>vp</literal> 中的元素排序:

        <programlisting>sort(vp.begin(), vp.end(), *_1 > *_2);</programlisting>

- In this call to <literal>sort</literal>, we are sorting the elements by their contents in descending order. + In this call to <literal>sort</literal>, we are sorting the elements by their contents in descending order. <sbr/> + 在这个 <literal>sort</literal> 的调用中,我们根据元素的内容以递减的顺序 排列那些元素。
       </para>

       <para>
- Finally, the following <literal>for_each</literal> call outputs the sorted content of <literal>vp</literal> separated by line breaks: + Finally, the following <literal>for_each</literal> call outputs the sorted content of <literal>vp</literal> separated by line breaks:<sbr/> + 最后,下面的 <literal>for_each</literal> 调用输出以换行符分隔的 <literal>vp</literal> 的排序后的内容:

 <programlisting>
 <![CDATA[for_each(vp.begin(), vp.end(), cout << *_1 << '\n');]]>
@@ -471,16 +577,22 @@

Note that a normal (non-lambda) expression as subexpression of a lambda expression is evaluated immediately.
 This may cause surprises.
-For instance, if the previous example is rewritten as
+For instance, if the previous example is rewritten as<sbr/>
+注意,作为一个 lambda 表达式的子表达式的一个常规(非 lambda 的)表达式立即 被求值。这可能让人觉得惊讶。
+例如,如果前面的示例被重写为:
 <programlisting>
 <![CDATA[for_each(vp.begin(), vp.end(), cout << '\n' << *_1);]]>
 </programlisting>
the subexpression <literal><![CDATA[cout << '\n']]></literal> is evaluated immediately and the effect is to output a single line break, followed by the elements of <literal>vp</literal>. -The BLL provides functions <literal>constant</literal> and <literal>var</literal> to turn constants and, respectively, variables into lambda expressions, and can be used to prevent the immediate evaluation of subexpressions: +The BLL provides functions <literal>constant</literal> and <literal>var</literal> to turn constants and, respectively, variables into lambda expressions, and can be used to prevent the immediate evaluation of subexpressions:<sbr/> +子表达式 <literal><![CDATA[cout << '\n']]></literal> 被立即求值,而效果是输 出一个单个换行符,后面跟着 +<literal>vp</literal> 的元素。BLL 提供函数 <literal>constant</literal> 和 <literal>var</literal> 分别将常量和变量引入
+lambda 表达式,并可用于防止子表达式的立即求值:
 <programlisting>
 <![CDATA[for_each(vp.begin(), vp.end(), cout << constant('\n') << *_1);]]>
 </programlisting>
-These functions are described more thoroughly in <xref linkend="lambda.delaying_constants_and_variables"/> +These functions are described more thoroughly in <xref linkend="lambda.delaying_constants_and_variables"/><sbr/> +关于这些函数的更彻底的描述,参见 <xref linkend="lambda.delaying_constants_and_variables"/>。

 </para>

@@ -492,7 +604,7 @@


     <section id="lambda.parameter_and_return_types">
-      <title>Parameter and return types of lambda functors</title>
+ <title>Parameter and return types of lambda functors lambda仿函数的 参数和返回类型</title>

       <para>
During the invocation of a lambda functor, the actual arguments are substituted for the placeholders.
@@ -500,7 +612,12 @@
The basic rule is that a lambda function can be called with arguments of any types, as long as the lambda expression with substitutions performed is a valid C++ expression.
        As an example, the expression
        <literal>_1 + _2</literal> creates a binary lambda functor.
- It can be called with two objects of any types <literal>A</literal> and <literal>B</literal> for which <literal>operator+(A,B)</literal> is defined (and for which BLL knows the return type of the operator, see below). + It can be called with two objects of any types <literal>A</literal> and <literal>B</literal> for which <literal>operator+(A,B)</literal> is defined (and for which BLL knows the return type of the operator, see below).<sbr/> + 通过 lambda 仿函数的调用,实际参数取代了占位符。占位符没有规定这些实际 参数的类型。 + 基本的规则是只要完成取代的 lambda 表达式是一个合法的 C++ 表达式,那么这 个 lambda 函数就能够用任何类型的参数调用。 + 例如,表达式 <literal>_1 + _2</literal> 创建一个二元 lambda 仿函数。它 能够被任意类型的两个对象 <literal>A</literal> + 和 <literal>B</literal> 调用,只要这两个对象定义了 <literal>operator+(A,B)</literal>(而且 BLL 知道这个操作符的返回类型,
+    参见后面的描述)。
       </para>

       <para>
@@ -508,16 +625,22 @@
However, this precise mechanism is crucial for the implementation of C++ lambda expressions. Consequently, BLL includes a somewhat complex type deduction system which uses a set of traits classes for deducing the resulting type of lambda functions. It handles expressions where the operands are of built-in types and many of the expressions with operands of standard library types. - Many of the user defined types are covered as well, particularly if the user defined operators obey normal conventions in defining the return types. + Many of the user defined types are covered as well, particularly if the user defined operators obey normal conventions in defining the return types. <sbr/> + C++ 缺乏一个查询某个表达式类型的机制。然而,这种精确的机制对于 C++ lambda 表达式的实现又是至关重要的。 + 因此,BLL 包含一个稍微复杂的类型推演系统,用一套特征类来推演 lambda 表 达式的结果类型。 + 它处理那些操作数是内建类型的表达式以及大多数操作数是标准库类型的表达 式。 + 大多数用户定义类型也同样适用,特别是在被定义的返回类型中的用户定义操作 符符合通常惯例。
       </para>

       <!-- TODO: move  this forward, and just refer to it. -->
       <para>
- There are, however, cases when the return type cannot be deduced. For example, suppose you have defined: + There are, however, cases when the return type cannot be deduced. For example, suppose you have defined:<sbr/>
+    然而,还是有一些情况返回类型无法推演。例如,假设你有这样的定义:

        <programlisting>C operator+(A, B);</programlisting>

- The following lambda function invocation fails, since the return type cannot be deduced: + The following lambda function invocation fails, since the return type cannot be deduced:<sbr/>
+    这个 lambda 表达式调用失败,因为返回类型无法被推演出来:

        <programlisting>A a; B b; (_1 + _2)(a, b);</programlisting>
       </para>
@@ -525,13 +648,17 @@
       <para>
        There are two alternative solutions to this.
The first is to extend the BLL type deduction system to cover your own types (see <xref linkend="lambda.extending"/>). - The second is to use a special lambda expression (<literal>ret</literal>) which defines the return type in place (see <xref linkend = "lambda.overriding_deduced_return_type"/>): + The second is to use a special lambda expression (<literal>ret</literal>) which defines the return type in place (see <xref linkend = "lambda.overriding_deduced_return_type"/>):<sbr/> + 对此有两种可供选择的解决方案。第一种是扩展 BLL 类型推演系统覆盖你自己的 类型(参见 <xref linkend="lambda.extending"/>)。 + 第二种是使用一个特殊的 lambda 表达式 (<literal>ret</literal>) 来就地定 义返回类型
+    (参见 <xref linkend = "lambda.overriding_deduced_return_type"/>):

<programlisting><![CDATA[A a; B b; ret<C>(_1 + _2)(a, b);]]></programlisting>
       </para>

       <para>
- For bind expressions, the return type can be defined as a template argument of the bind function as well: + For bind expressions, the return type can be defined as a template argument of the bind function as well: <sbr/>
+    对于 bind 表达式,返回类型的定义就像是 bind 函数的一个模板参数一样:
        <programlisting><![CDATA[bind<int>(foo, _1, _2);]]></programlisting>

 <!--
@@ -542,7 +669,7 @@
     </section>

     <section id="lambda.actual_arguments_to_lambda_functors">
-      <title>About actual arguments to lambda functors</title>
+ <title>About actual arguments to lambda functors 关于 lambda 仿函数的 实际参数</title>

<!-- <para><emphasis>This section is no longer (or currently) relevant;
        acual arguments can be non-const rvalues.
@@ -550,7 +677,8 @@
        lambda functors with higher arities than 3.</emphasis></para> -->

<para>A general restriction for the actual arguments is that they cannot be non-const rvalues.
-       For example:
+       For example:<sbr/>
+    对实际参数的一个大体限制是它们不能是非常量的右值。例如:

 <programlisting>
 int i = 1; int j = 2;
@@ -562,7 +690,10 @@
        Since the lambda functors are most often called inside STL-algorithms,
the arguments originate from dereferencing iterators and the dereferencing operators seldom return rvalues.
        And for the cases where they do, there are workarounds discussed in
-<xref linkend="lambda.rvalues_as_actual_arguments"/>.
+<xref linkend="lambda.rvalues_as_actual_arguments"/>.<sbr/>
+这一限制也许不像看上去那么糟糕。因为 lambda 仿函数最常用在 STL 算法中,
+参数来自于很少返回右值的间接引用迭代器和间接引用操作符。对于它们返回右值的 情况,
+相关讨论参见 <xref linkend="lambda.rvalues_as_actual_arguments"/>。


       </para>
@@ -572,7 +703,7 @@

 <section id="lambda.storing_bound_arguments">

-<title>Storing bound arguments in lambda functions</title>
+<title>Storing bound arguments in lambda functions 在 lambda 函数中存储已绑 定参数</title>

 <para>

@@ -582,7 +713,9 @@
 This means that the value of a bound argument is fixed at the time of the
 creation of the lambda function and remains constant during the lifetime
 of the lambda function object.
-For example:
+For example:<sbr/>
+缺省情况下,已绑定参数的 temporary const copies(临时常拷贝)存储在 lambda 仿函数中。 +这就意味着已绑定参数的值在 lambda 函数的创建时是固定的,而且在这个 lambda 函数对象的整个生命周期中也会保持不变。例如:
 <programlisting>
 int i = 1;
 (_1 = 2, _1 + i)(i);
@@ -593,14 +726,18 @@
 The value of the expression in the last line is 3, not 4.
 In other words, the lambda expression that is created is
 <literal>lambda x.(x = 2, x + 1)</literal> rather than
-<literal>lambda x.(x = 2, x + i)</literal>.
+<literal>lambda x.(x = 2, x + i)</literal>.<sbr/>
+逗号操作符被重载用来将 lambda 表达式结合到一个序列中,结果是,一元 lambda 仿函数的参数首先被赋为 2, +然后再为它加上 <literal>i</literal> 的值。最终表达式的值是 3,不是 4。换句 话说,lambda 表达式由 +<literal>lambda x.(x = 2, x + 1)</literal> 创建,而不是 <literal>lambda x.(x = 2, x + i)</literal>。

 </para>

 <para>

 As said, this is the default behavior for which there are exceptions.
-The exact rules are as follows:
+The exact rules are as follows:<sbr/>
+就像我们说过的,这是有例外的缺省行为。严格的规则如下:

 <itemizedlist>

@@ -618,7 +755,11 @@
 For example, if we rewrite the previous example and wrap the variable
 <literal>i</literal> with <literal>ref</literal>,
we are creating the lambda expression <literal>lambda x.(x = 2, x + i)</literal>
-and the value of the expression in the last line will be 4:
+and the value of the expression in the last line will be 4:<sbr/>
+程序员可以控制使用 <literal>ref</literal> 和 <literal>cref</literal> 包装的 存储机制 [<xref linkend="cit:boost::ref"/>]。 +用 <literal>ref</literal> 或 <literal>cref</literal> 包装一个参数,分别指示 库将参数作为一个引用或常引用来存储。 +例如,如果我们重写前面的示例,并用 <literal>ref</literal> 包装变量 <literal>i</literal>, +我们可以创建 lambda 表达式 <literal>lambda x.(x = 2, x + i)</literal> ,而 且表达式最终的值是 4:

 <programlisting>
 i = 1;
@@ -629,7 +770,9 @@
 from <literal>var</literal> and <literal>constant</literal>.

 While the latter ones create lambda functors, the former do not.
-For example:
+For example:<sbr/>
+注意,<literal>ref</literal> 和 <literal>cref</literal> 不同于 <literal>var</literal> 和 <literal>constant</literal>。
+后者创建 lambda 仿函数,而前者不创建。例如:

 <programlisting>
 int i;
@@ -645,14 +788,20 @@
 See <xref linkend="lambda.delaying_constants_and_variables"/> for details.
 The <literal>ref</literal> and <literal>cref</literal> functions are
 general purpose utility functions in Boost, and hence defined directly
-in the <literal moreinfo="none">boost</literal> namespace.
+in the <literal moreinfo="none">boost</literal> namespace.<sbr/>
+函数 <literal>ref</literal> 和 <literal>cref</literal> 的存在主要是由于历史 原因, +而且 <literal>ref</literal> 总是能被 <literal>var</literal> 取代,而 <literal>cref</literal> +总能被 <literal>constant_ref</literal> 取代。关于细节,参见 <xref linkend="lambda.delaying_constants_and_variables"/>。 +<literal>ref</literal> 和 <literal>cref</literal> 函数是 Boost 中的通用工具 函数,
+因此直接定义在 <literal moreinfo="none">boost</literal> 名字空间中。

 </para>
 </listitem>

 <listitem>
 <para>
-Array types cannot be copied, they are thus stored as const reference by default. +Array types cannot be copied, they are thus stored as const reference by default.<sbr/>
+数组类型不能被拷贝,因此,缺省情况下,它们作为常引用存储。
 </para>
 </listitem>

@@ -669,23 +818,30 @@
 As another example, the streaming operators take their leftmost argument
 as non-const references.

-The exact rules are:
+The exact rules are:<sbr/>
+对于某些表达式,参数作为引用存储更有意义。例如,lambda 表达式 <literal>i += _1</literal> +的意图很明显是要调用 lambda 仿函数以影响变量 <literal>i</literal> 的值,而 不是它的什么临时拷贝。
+再例如,流操作符把它的最左边的参数作为 非常量引用。严格规则为:

 <itemizedlist>
 <listitem>
-<para>The left argument of compound assignment operators (<literal>+=</literal>, <literal>*=</literal>, etc.) are stored as references to non-const.</para> +<para>The left argument of compound assignment operators (<literal>+=</literal>, <literal>*=</literal>, etc.) are stored as references to non-const.<sbr/> +混合赋值操作符 (<literal>+=</literal>, <literal>*=</literal>, 等等) 的左参 数作为引向非常量的引用存储。</para>
 </listitem>

 <listitem>
<para>If the left argument of <literal><![CDATA[<<]]></literal> or <literal><![CDATA[>>]]></literal> operator is derived from an instantiation of <literal>basic_ostream</literal> or respectively from <literal>basic_istream</literal>, the argument is stored as a reference to non-const.
-For all other types, the argument is stored as a copy.
+For all other types, the argument is stored as a copy.<sbr/>
+如果 <literal><![CDATA[<<]]></literal> 或 <literal><![CDATA[>>]]></literal> 操作符的左参数分别从 <literal>basic_ostream</literal> +或 <literal>basic_istream</literal> 的实例派生,则参数作为引向非常量的引用 存储。对于所有其它类型,参数作为一个拷贝存储。
 </para>
 </listitem>

 <listitem>
 <para>
In pointer arithmetic expressions, non-const array types are stored as non-const references.
-This is to prevent pointer arithmetic making non-const arrays const.
+This is to prevent pointer arithmetic making non-const arrays const. <sbr/>
+在指针算数表达式中,非常量数组作为非常量引用来存储。这是为了防止指针算术运 算使非常量数组常量化。

 </para>
 </listitem>
@@ -703,17 +859,18 @@
 </section>

 <section id="lambda.le_in_details">
-<title>Lambda expressions in details</title>
+<title>Lambda expressions in details  lambda表达式详细研究</title>

 <para>
This section describes different categories of lambda expressions in details. -We devote a separate section for each of the possible forms of a lambda expression. +We devote a separate section for each of the possible forms of a lambda expression.<sbr/> +本节详细描述 lambda 表达式的各个不同方面。我们为一个 lambda 表达式的每一种 可能的形式都投入一个专门的部分。


 </para>

 <section id="lambda.placeholders">
-<title>Placeholders</title>
+<title>Placeholders 占位符</title>

 <para>
The BLL defines three placeholder types: <literal>placeholder1_type</literal>, <literal>placeholder2_type</literal> and <literal>placeholder3_type</literal>.
@@ -721,19 +878,25 @@
 However, the user is not forced to use these placeholders.
 It is easy to define placeholders with alternative names.
 This is done by defining new variables of placeholder types.
-For example:
+For example:<sbr/>
+BLL 定义了三个占位符类型:<literal>placeholder1_type</literal>, <literal>placeholder2_type</literal> +和 <literal>placeholder3_type</literal>。BLL 为每一个占位符类型提供了一个预 定义的占位符变量: +<literal>_1</literal>, <literal>_2</literal> 和 <literal>_3</literal>。然 而,用户并没有被强制使用这些变量, +定义其它名字的占位符也很简单。可以通过定义新的占位符类型的变量来做到这一 点。例如:

 <programlisting>boost::lambda::placeholder1_type X;
 boost::lambda::placeholder2_type Y;
 boost::lambda::placeholder3_type Z;
 </programlisting>

-With these variables defined, <literal>X += Y * Z</literal> is equivalent to <literal>_1 += _2 * _3</literal>. +With these variables defined, <literal>X += Y * Z</literal> is equivalent to <literal>_1 += _2 * _3</literal>.<sbr/> +有了这些变量定义,那么 <literal>X += Y * Z</literal> 就等价于 <literal>_1 += _2 * _3</literal>。
 </para>

 <para>
The use of placeholders in the lambda expression determines whether the resulting function is nullary, unary, binary or 3-ary.
-The highest placeholder index is decisive. For example:
+The highest placeholder index is decisive. For example:<sbr/>
+占位符在 lambda 表达式中的使用决定了结果函数是无元的,一元的,二元的还是三 元的。这由最高的占位符索引决定。例如:

 <programlisting>
 _1 + 5              // unary
@@ -749,7 +912,10 @@
One can always provide more arguments (up the number of supported placeholders)
 that is really needed.
 The remaining arguments are just discarded.
-For example:
+For example:<sbr/>
+注意,最后一行创建了一个三元函数,它在它的<emphasis>第三个</emphasis>参数上 加 <literal>10</literal>。 +不去理会前两个参数。而且,lambda 仿函数只有一个最小的数量。它总能提供真正需 要的更多的参数(增加支持占位符的数量)。
+多余的参数只是被丢弃。例如:

 <programlisting>
 int i, j, k;
@@ -759,18 +925,22 @@

 See
<xref linkend="lambda.why_weak_arity"/> for the design rationale behind this
-functionality.
+functionality.<sbr/>
+如果要了解这一功能背后的设计原理,参见 <xref linkend="lambda.why_weak_arity"/>。

 </para>

 <para>
In addition to these three placeholder types, there is also a fourth placeholder type <literal>placeholderE_type</literal>. -The use of this placeholder is defined in <xref linkend="lambda.exceptions"/> describing exception handling in lambda expressions. +The use of this placeholder is defined in <xref linkend="lambda.exceptions"/> describing exception handling in lambda expressions.<sbr/> +除了这三个占位符类型之外,还有第四个占位符类型 <literal>placeholderE_type</literal>。 +这个占位符的作用是定义 <xref linkend="lambda.exceptions"/> 描述的 lambda 表 达式中的异常处理。
 </para>

<para>When an actual argument is supplied for a placeholder, the parameter passing mode is always by reference. This means that any side-effects to the placeholder are reflected to the actual argument.
-For example:
+For example:<sbr/>
+为一个占位符提供真正的参数的时候,参数传递的方式总是传引用。这就意味着任何 影响占位符的副作用都会反映到实际参数上。例如:


 <programlisting>
@@ -783,38 +953,46 @@
 </section>

 <section id="lambda.operator_expressions">
-<title>Operator expressions</title>
+<title>Operator expressions 操作符表达式</title>

 <para>
The basic rule is that any C++ operator invocation with at least one argument being a lambda expression is itself a lambda expression.
 Almost all overloadable operators are supported.
-For example, the following is a valid lambda expression:
+For example, the following is a valid lambda expression:<sbr/>
+基本规则是任何 C++ 操作符调用,只要它的参数中至少有一个是 lambda 表达式,则 这个调用本身也是 lambda 表达式。
+几乎所有的能重载操作符都已被支持。例如,下面就是一个合法的 lambda 表达式:

<programlisting><![CDATA[cout << _1, _2[_3] = _1 && false]]></programlisting>
 </para>

 <para>
-However, there are some restrictions that originate from the C++ operator overloading rules, and some special cases. +However, there are some restrictions that originate from the C++ operator overloading rules, and some special cases.<sbr/>
+然而,有一些来自于 C++ 操作符重载规则的限制,以及一些特殊情况。
 </para>


 <section>
-<title>Operators that cannot be overloaded</title>
+<title>Operators that cannot be overloaded 不能重载的操作符</title>

 <para>
Some operators cannot be overloaded at all (<literal>::</literal>, <literal>.</literal>, <literal>.*</literal>). For some operators, the requirements on return types prevent them to be overloaded to create lambda functors. -These operators are <literal>->.</literal>, <literal>-></literal>, <literal>new</literal>, <literal>new[]</literal>, <literal>delete</literal>, <literal>delete[]</literal> and <literal>?:</literal> (the conditional operator). +These operators are <literal>->.</literal>, <literal>-></literal>, <literal>new</literal>, <literal>new[]</literal>, <literal>delete</literal>, <literal>delete[]</literal> and <literal>?:</literal> (the conditional operator).<sbr/> +有些操作符根本不能重载(<literal>::</literal>, <literal>.</literal>, <literal>.*</literal>)。 +对于有些操作符,对返回类型的要求阻碍了它们为创建 lambda 函数而重载。这些操 作符有 <literal>->.</literal>, +<literal>-></literal>, <literal>new</literal>, <literal>new[]</literal>, <literal>delete</literal>, <literal>delete[]</literal>
+和 <literal>?:</literal>(条件操作符)。
 </para>

 </section>

 <section id="lambda.assignment_and_subscript">
-<title>Assignment and subscript operators</title>
+<title>Assignment and subscript operators 赋值和下标操作符</title>

 <para>
 These operators must be implemented as class members.
-Consequently, the left operand must be a lambda expression. For example:
+Consequently, the left operand must be a lambda expression. For example:<sbr/> +这些操作符必须被实现为类成员。因此,左操作数必须是一个 lambda 表达式。例 如:

 <programlisting>
 int i;
@@ -824,7 +1002,9 @@

There is a simple solution around this limitation, described in <xref linkend="lambda.delaying_constants_and_variables"/>.
 In short,
-the left hand argument can be explicitly turned into a lambda functor by wrapping it with a special <literal>var</literal> function: +the left hand argument can be explicitly turned into a lambda functor by wrapping it with a special <literal>var</literal> function:<sbr/> +关于这一限制有一个简单的解决方案,在 <xref linkend="lambda.delaying_constants_and_variables"/>描述。 +简而言之,就是通过用一个特殊的 <literal>var</literal> 函数进行包装,左侧参 数可以被显式转变为 lambda 仿函数:
 <programlisting>
 var(i) = _1; // ok
 </programlisting>
@@ -833,10 +1013,11 @@
 </section>

 <section id="lambda.logical_operators">
-<title>Logical operators</title>
+<title>Logical operators 逻辑操作符</title>

 <para>
-Logical operators obey the short-circuiting evaluation rules. For example, in the following code, <literal>i</literal> is never incremented: +Logical operators obey the short-circuiting evaluation rules. For example, in the following code, <literal>i</literal> is never incremented:<sbr/> +逻辑操作符服从短路求值规则。例如,在下面的代码中,<literal>i</literal> 没有 被增加:
 <programlisting>
 bool flag = true; int i = 0;
 (_1 || ++_2)(flag, i);
@@ -845,50 +1026,62 @@
 </section>

 <section id="lambda.comma_operator">
-<title>Comma operator</title>
+<title>Comma operator 逗号操作符</title>

 <para>
Comma operator is the <quote>statement separator</quote> in lambda expressions. -Since comma is also the separator between arguments in a function call, extra parenthesis are sometimes needed: +Since comma is also the separator between arguments in a function call, extra parenthesis are sometimes needed:<sbr/> +逗号操作符在 lambda 表达式中是<quote>语句分隔符</quote>。因为逗号也是函数调 用中的参数分隔符,所以有时需要额外的括号:

***The diff for this file has been truncated for email.***

Other related posts:

  • » [boost-doc-zh] r364 committed - 翻译 hash, intrusive, lambda 库的xml/qbk文件 - boost-doc-zh