[boost-doc-zh commit] r232 - 完成 swap 库文档翻译

  • From: codesite-noreply@xxxxxxxxxx
  • To: boost-doc-zh-notify@xxxxxxxxxxxxx
  • Date: Wed, 01 Apr 2009 03:15:43 +0000

Author: alai04
Date: Tue Mar 31 20:05:18 2009
New Revision: 232

Modified:
   trunk/libs/libraries.htm
   trunk/libs/utility/swap.html

Log:
完成 swap 库文档翻译

Modified: trunk/libs/libraries.htm
==============================================================================
--- trunk/libs/libraries.htm    (original)
+++ trunk/libs/libraries.htm    Tue Mar 31 20:05:18 2009
@@ -641,7 +641,7 @@
container</a>, <a href="preprocessor/doc/index.html">preprocessor</a>, <a href="../doc/html/program_options.html">program_options</a>, <a href="property_map/property_map.html">property map</a>, <a href="proto/index.html">proto</a>, <a href="range/index.html">range</a>, <a href="rational/index.html">rational</a>, <a href="serialization/doc/index.html">serialization</a>, -<a href="statechart/doc/index.html">statechart</a>,&nbsp;<a href="system/doc/index.html">system</a>, <a href="tokenizer/index.html">tokenizer</a>, <a href="tr1/index.html">TR1</a>, <a href="../doc/html/tribool.html">tribool</a>, <a href="../doc/html/unordered.html">unordered</a>, <a href="utility/utility.htm">utility</a>, <a href="utility/value_init.htm">value_initialized</a>, <a href="variant/index.html">variant</a>,&nbsp;<a href="wave/index.html">wave</a> 以及 <a href="../doc/html/tools.html">Boost Tools</a>&nbsp; </p> +<a href="statechart/doc/index.html">statechart</a>, <a href="utility/swap.html">swap</a>, <a href="system/doc/index.html">system</a>, <a href="tokenizer/index.html">tokenizer</a>, <a href="tr1/index.html">TR1</a>, <a href="../doc/html/tribool.html">tribool</a>, <a href="../doc/html/unordered.html">unordered</a>, <a href="utility/utility.htm">utility</a>, <a href="utility/value_init.htm">value_initialized</a>, <a href="variant/index.html">variant</a>,&nbsp;<a href="wave/index.html">wave</a> 以及 <a href="../doc/html/tools.html">Boost Tools</a>&nbsp; </p>
 <p>fatalerror99:<a href="array/index.html">array</a>,
<a href="bind/bind.html">bind</a> and <a href="bind/mem_fn.html">mem_fn</a>, <a href="dynamic_bitset/dynamic_bitset.html">dynamic_bitset</a>, <a href="function/index.html">function</a>, <a href="functional/hash/index.html">functional/hash</a>, <a href="utility/in_place_factories.html">in_place_factory,

Modified: trunk/libs/utility/swap.html
==============================================================================
--- trunk/libs/utility/swap.html        (original)
+++ trunk/libs/utility/swap.html        Tue Mar 31 20:05:18 2009
@@ -1,13 +1,12 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
-<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en-US" lang="en-US">
-  <head>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> +<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en-US" lang="en-US"><head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>Boost: Swap Documentation</title>
-   </head>
+    <title>Boost: Swap Documentation</title></head>
+
+
   <body>
     <!-- Page header -->
- <img src="../../boost.png" alt="C++ Boost" align="middle" width="277" height="86"/> + <img src="../../boost.png" alt="C++ Boost" align="middle" height="86" width="277" />
     <h1>Swap</h1>

     <p>
@@ -16,79 +15,95 @@

     <!-- Introduction -->
     <p>
- The template function <tt>boost::swap</tt> allows the values of two variables to be swapped, using argument dependent lookup to select a specialized swap function if available. If no specialized swap function is available, <tt>std::swap</tt> is used.
+      The template function <tt>boost::swap</tt> allows the values of
+two variables to be swapped, using argument dependent lookup to select
+a specialized swap function if available. If no specialized swap
+function is available, <tt>std::swap</tt> is used.<br />函数模板 <tt>boost::swap</tt> 允许两个变量交换它们的值,它使用实参依赖查找(ADL)来选择 可用的特化 swap 函数。如果没有可用的特化 swap 函数,就使用 <tt>std::swap</tt>。
     </p>

     <!-- Rationale -->
-    <h2>Rationale</h2>
-    <p>
- The generic <tt>std::swap</tt> function requires that the elements to be swapped are assignable and copy constructible. It is usually implemented using one copy construction and two assignments - this is often both unnecessarily restrictive and unnecessarily slow. In addition, where the generic swap implementation provides only the basic guarantee, specialized swap functions are often able to provide the no-throw exception guarantee (and it is considered best practice to do so where possible<sup><a href="#ref1">1</a></sup>).</p>
+    <h2>Rationale 原理</h2>
     <p>
- The alternative to using argument dependent lookup in this situation is to provide a template specialization of <tt>std::swap</tt> for every type that requires a specialized swap. Although this is legal C++, no Boost libraries use this method, whereas many Boost libraries provide specialized swap functions in their own namespaces.
+      The generic <tt>std::swap</tt> function requires that the
+elements to be swapped are assignable and copy constructible. It is
+usually implemented using one copy construction and two assignments -
+this is often both unnecessarily restrictive and unnecessarily slow. In
+addition, where the generic swap implementation provides only the basic
+guarantee, specialized swap functions are often able to provide the
+no-throw exception guarantee (and it is considered best practice to do
+so where possible<sup><a href="swap.html#ref1">1</a></sup>).<br />普通的 <tt>std::swap</tt> +函数要求被交换的元素必须是可赋值且可复制构造的。它是用一次复制构造和两次赋 值来实现的 - +一般来说,这是不必要的限制,而且也比较慢。此外,这个通用的 swap 实现只提供 了基本的异常安全保证,而特化的 swap +函数通常可以提供无抛出的异常安全保证(而且可被视为有可能的最好实现<sup><a href="#ref1">1</a></sup>)。</p>
+    <p>
+ The alternative to using argument dependent lookup in this situation is to provide a template specialization of <tt>std::swap</tt>
+for every type that requires a specialized swap. Although this is legal
+C++, no Boost libraries use this method, whereas many Boost libraries
+provide specialized swap functions in their own namespaces.<br />另一种方法 是,在此情形下使用实参依赖查找,为每一个需要特化 swap 的类型提供一个 <tt>std::swap</tt> 的模板特化。虽然这是合法的 C++,但是没有一个 Boost 库使用 了这种方法,多数 Boost 库在它们自己的名字空间中提供特化的 swap 函数。
     </p>
     <p>
- <tt>boost::swap</tt> also supports swapping built-in arrays. Note that <tt>std::swap</tt> originally did not do so, but a request to add an overload of <tt>std::swap</tt> for built-in arrays has been accepted by the C++ Standards Committee<sup><a href="#ref2">2</a></sup>. + <tt>boost::swap</tt> also supports swapping built-in arrays. Note that <tt>std::swap</tt> originally did not do so, but a request to add an overload of <tt>std::swap</tt> for built-in arrays has been accepted by the C++ Standards Committee<sup><a href="swap.html#ref2">2</a></sup>.<br /><tt>boost::swap</tt> 也支持内建数组的交换。注意,<tt>std::swap</tt> 最初并 不这样做,不过,为内建数组增加一个 <tt>std::swap</tt> 重载这一请求已经被 C++ 标准委员会接纳<sup><a href="#ref2">2</a></sup>。
     </p>

     <!-- Exception Safety -->
-    <h2>Exception Safety</h2>
+    <h2>Exception Safety 异常安全性</h2>
     <p>
- <tt>boost::swap</tt> provides the same exception guarantee as the underlying swap function used, with one exception; for an array of type <tt>T[n]</tt>, where <tt>n > 1</tt> and the underlying swap function for <tt>T</tt> provides the strong exception guarantee, <tt>boost::swap</tt> provides only the basic exception guarantee. + <tt>boost::swap</tt> provides the same exception guarantee as the underlying swap function used, with one exception; for an array of type <tt>T[n]</tt>, where <tt>n &gt; 1</tt> and the underlying swap function for <tt>T</tt> provides the strong exception guarantee, <tt>boost::swap</tt> provides only the basic exception guarantee.<br /><tt>boost::swap</tt> 提供 了与其所用的底层 swap 函数相同的异常安全保证,除了一种例外情况;对于数组类 型 <tt>T[n]</tt>,当 <tt>n &gt; 1</tt> 且 <tt>T</tt> 的底层 swap 函数提供强 异常安全保证时,<tt>boost::swap</tt> 只提供基本异常安全保证。
     </p>

     <!-- Requirements -->
-    <h2>Requirements</h2>
-    <p>Either:</p>
+    <h2>Requirements 要求</h2>
+    <p>Either:<br />或者:</p>
     <ul>
-      <li>T must be assignable</li>
-      <li>T must be copy constructible</li>
+      <li>T must be assignable<br />T 必须是可赋值的</li>
+      <li>T must be copy constructible<br />T 必须是可复制构造的</li>
     </ul>
-    <p>Or:</p>
+    <p>Or:<br />或者:</p>
     <ul>
- <li>A function with the signature <tt>swap(T&amp;,T&amp;)</tt> is available via argument dependent lookup</li> + <li>A function with the signature <tt>swap(T&amp;,T&amp;)</tt> is available via argument dependent lookup<br />通过ADL可以找到函数签名为 <tt>swap(T&amp;,T&amp;)</tt> 的函数</li>
     </ul>
-    <p>Or:</p>
+    <p>Or:<br />或者:</p>
     <ul>
-      <li>A template specialization of <tt>std::swap</tt> exists for T</li>
+ <li>A template specialization of <tt>std::swap</tt> exists for T<br />有一个针对 T 的 <tt>std::swap</tt> 特化模板</li>
     </ul>
-    <p>Or:</p>
+    <p>Or:<br />或者:</p>
     <ul>
-      <li>T is a built-in array of swappable elements</li>
+ <li>T is a built-in array of swappable elements<br />T 是可交换元素的 内建数组</li>
     </ul>


     <!-- Portability -->
-    <h2>Portability</h2>
+    <h2>Portability 可移植性</h2>
     <p>
- Several older compilers do not support argument dependent lookup &#x2012; on these compilers <tt>boost::swap</tt> will call <tt>std::swap</tt>, ignoring any specialized swap functions that could be found as a result of argument dependent lookup. + Several older compilers do not support argument dependent lookup - on these compilers <tt>boost::swap</tt> will call <tt>std::swap</tt>, ignoring any specialized swap functions that could be found as a result of argument dependent lookup.<br />有几个老的编译器不支持ADL - 在这些编译器上 <tt>boost::swap</tt> 将直接调用 <tt>std::swap</tt>,忽略任意可以由ADL找到的 特化 swap 函数。
     </p>

     <!-- Credits -->
-    <h2>Credits</h2>
+    <h2>Credits 荣誉</h2>
     <ul>
       <li>
- <em>Niels Dekker</em> - for implementing and documenting support for built-in arrays + <em>Niels Dekker</em> - for implementing and documenting support for built-in arrays<br /><em>Niels Dekker</em> - 对内建数组支持的实现和文档 编写
       </li>
       <li>
- <em><a href="mailto:Joseph.Gauterin@xxxxxxxxxxxxxx";>Joseph Gauterin</a></em> - for the initial idea, implementation, tests, and documentation + <em><a href="mailto:Joseph.Gauterin@xxxxxxxxxxxxxx";>Joseph Gauterin</a></em> - for the initial idea, implementation, tests, and documentation<br /><em><a href="mailto:Joseph.Gauterin@xxxxxxxxxxxxxx";>Joseph Gauterin</a></em> - 起初 的想法、实现、测试和文档编写
       </li>
       <li>
- <em>Steven Watanabe</em> - for the idea to make <tt>boost::swap</tt> less specialized than <tt>std::swap</tt>, thereby allowing the function to have the name 'swap' without introducing ambiguity + <em>Steven Watanabe</em> - for the idea to make <tt>boost::swap</tt> less specialized than <tt>std::swap</tt>, thereby allowing the function to have the name 'swap' without introducing ambiguity<br /><em>Steven Watanabe</em> - 提出让 <tt>boost::swap</tt> 比 <tt>std::swap</tt> 更少限制的想法,从而允许带有名字'swap'的函数不会引起歧义
       </li>
     </ul>

     <!-- References -->
-    <hr/>
- <p><sup><a id="ref1"/>[1]</sup>Scott Meyers, Effective C++ Third Edition, Item 25: "Consider support for a non-throwing swap"</p> - <p><sup><a id="ref2"/>[2]</sup><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#809";>LWG Defect Report 809 (std::swap should be overloaded for array types)</a></p>
+    <hr />
+ <p><sup><a id="ref1">[1]</a></sup><a id="ref1">Scott Meyers, Effective C++ Third Edition, Item 25: "Consider support for a non-throwing swap"</a></p> +<a id="ref1"> </a><p><a id="ref1"><sup></sup></a><sup><a id="ref2">[2]</a></sup><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#809";>LWG Defect Report 809 (std::swap should be overloaded for array types)</a></p>

     <!-- Copyright info -->
-    <hr/>
+    <hr />
     <p>Revised: 15 November 2008</p>
     <p>
- Copyright 2007, 2008 Joseph Gauterin. Use, modification, and distribution are subject to the Boost Software License, Version 1.0. - (See accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at &lt;<a href="http://www.boost.org/LICENSE_1_0.txt";>http://www.boost.org/LICENSE_1_0.txt</a>&gt;.)
+Copyright 2007, 2008 Joseph Gauterin. Use, modification, and
+distribution are subject to the Boost Software License, Version 1.0.
+(See accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at &lt;<a href="http://www.boost.org/LICENSE_1_0.txt";>http://www.boost.org/LICENSE_1_0.txt</a>&gt;.)
     </p>

-  </body>
-</html>
+  </body></html>
\ No newline at end of file

Other related posts:

  • » [boost-doc-zh commit] r232 - 完成 swap 库文档翻译 - codesite-noreply