[boost-doc-zh] r412 committed - 修改部分语句令其更通顺,美化排版

  • From: boost-doc-zh@xxxxxxxxxxxxxx
  • To: boost-doc-zh-notify@xxxxxxxxxxxxx
  • Date: Fri, 11 Jun 2010 04:45:53 +0000

Revision: 412
Author: comicfans44
Date: Thu Jun 10 21:45:15 2010
Log: 修改部分语句令其更通顺,美化排版
http://code.google.com/p/boost-doc-zh/source/detail?r=412

Modified:
 /trunk/libs/functional/factory/doc/factory.qbk

=======================================
--- /trunk/libs/functional/factory/doc/factory.qbk      Thu Jun 10 08:23:31 2010
+++ /trunk/libs/functional/factory/doc/factory.qbk      Thu Jun 10 21:45:15 2010
@@ -45,8 +45,8 @@
 The template __boost__factory__ lets you encapsulate a `new` expression
 as a function object, __boost__value_factory__ encapsulates a constructor
 invocation without `new`.\n
-模板 __boost__factory__可令你以函数对象(仿函数)形式来封装 `new` 表达式,
-而 __boost__value_factory__ 则可以非 `new` 的形式调用构造函数
+模板 __boost__factory__可令你以函数对象(仿函数)形式来封装 `new` 表达式,
+而 __boost__value_factory__ 则可以非 `new` 的形式调用构造函数。


     __boost__factory__<T*>()(arg1,arg2,arg3)
@@ -55,7 +55,7 @@

     __boost__value_factory__<T>()(arg1,arg2,arg3)
     // same as T(arg1,arg2,arg3)
-    //如同调用 T(arg1,arg2,arg3)
+    // 如同调用 T(arg1,arg2,arg3)

 For technical reasons the arguments to the function objects have to be
 LValues. A factory that also accepts RValues can be composed using the
@@ -126,9 +126,8 @@
 lots of boilerplate code. In other words there is too much code to express
 a rather simple intention. We could use templates to get rid of some of it
 but the approach remains inflexible: \n
-以上实现方法有几个缺点,最明显者就是有太多重复死板的代码。换言之,如此多的
-代码与要实现的简单目的相比有些小题大做。使用模板可避免以上某些缺点,
-但仍不够灵活:
+以上实现方法有几个缺点,最明显者就是有太多重复死板的代码。换言之,
+如此多的代码与要实现的简单目的相比有些小题大做。使用模板可避免以上某些缺 点,但仍不够灵活:

  o We may want a factory that takes some arguments that are forwarded to
    the constructor,
@@ -142,10 +141,10 @@
  o finally we might want to use customized memory management.

 * 可能需要工厂接受参数后能转发(非拷贝语义)至构造函数,
-* 需要工厂能够产生 smart pointer (智能指针),
-* 需要(工厂具备 )多个成员函数以产生不同类型的对象,
-* 对于产生的对象而言,甚至多态基类也可能不是必须的,
-* 我们将会看到,工厂完全不需要一个公共的基类,
+* 需要工厂能够产生 smart pointer (智能指针),
+* 需要(工厂具备 )多个成员函数以产生不同类型的对象,
+* 对于产生的对象而言,甚至多态基类也可能不是必须的,
+* 我们将会看到,工厂完全不需要一个公共的基类,
 * 所需的仅仅是调用构造函数,能够在栈上构造而非调用 `new` 并且
 * 除此之外还能够进行定制化的内存管理。

@@ -156,15 +155,14 @@
Oriented methodology) become implementable with just few code lines and without
 extra classes. \n
经验告诉我们,使用函数对象(仿函数)和 Boost 泛型组件组合来实现回调机制的设 计模式, -无需额外的类,寥寥数行即可完。相比之下同样的功能在纯面向对象方法实现中通常 需要大量
-的呆板代码。
+无需额外的类,寥寥数行即可完。相比之下同样的功能在纯面向对象方法实现中通常 需要大量的呆板代码。


 Factories are callback mechanisms for constructors, so we provide two class
 templates, __boost__value_factory__ and __boost__factory__, that encasulate
 object construction via direct application of the constructor and the `new`
 operator, respectively. \n
-工厂即是对构造函数的一种回调机制,对应于此本库提供了两个类模板, __boost__value_factory__ +工厂即是对构造函数的一种回调机制,对应于此本库提供了两个类模板, __boost__value_factory__ 和 __boost__factory__,对应封装了直接使用构造函数和 `new` 操作符对对象的构 造。

 We let the function objects forward their arguments to the construction
@@ -260,8 +258,9 @@
 the type of the factory and thus allow polymorphism at run time, we can
 use __boost_function__ to do so. The first example can be rewritten as
 follows.\n
-尽管前例中我们建立了多态的对象,但仍在工厂中使用了编译期多态。如果希望在工 厂中 -隐藏具体类型而达到运行期多态,则可使用 __boost_function__ 来完成。前例可重 写如下。
+尽管前例中我们建立了多态的对象,但仍在工厂中使用了编译期多态。
+如果希望在工厂中隐藏具体类型而达到运行期多态,则可使用 __boost_function__ 来完成。
+前例可重写如下。

     typedef boost::function< an_abstract_class*() > a_factory;

@@ -295,12 +294,12 @@
 [heading Description(概述)]

 Function object template that invokes the constructor of the type `T`.\n
-调用类型 `T` 构造函数的函数对象模板。
+用于调用类型 `T` 构造函数的函数对象模板。

 [heading Header(头文件)]
     #include <boost/functional/value_factory.hpp>

-[heading:synopsis Synopsis(摘要)]
+[heading Synopsis(摘要)]

     namespace boost
     {
@@ -330,7 +329,7 @@
     [[`f(a0`...`aN)`]   [returns `T(a0`...`aN)`. \n
     返回`T(a0`...`aN)`。]]
     [[`F::result_type`] [is the type `T`.  \n
-    `T`的类型]]
+    `T`的类型。]]
 ]

 [heading Limits(限制)]
@@ -361,18 +360,18 @@
 with a copy of the Allocator is used for the second constructor argument
 of `Pointer` (thus it must be a __smart_pointer__ that provides a suitable
 constructor, such as __boost__shared_ptr__).\n
-若给定了 __allocator__ (分配器)参数,则其作为 `new` 操作符构建对象时分 配、及其就地分配形式 -的内存管理之用。一个带有 Allocator (分配器)拷贝并用于调用析构函数、回收内 存的函数对象将 -作为第二个参数传递给 `Pointer` 类的构造函数(要求一个 __smart_pointer__ (智能指针)必须有
-符合要求的构造函数,比如 __boost__shared_ptr__)。
+若给定了 __allocator__ (分配器)参数,则其作为 `new` 操作符构建对象时分 配、 +及其就地分配形式的内存管理之用。一个带有 Allocator (分配器)拷贝并用于调用 析构函数、
+回收内存的函数对象将作为第二个参数传递给 `Pointer` 类的构造函数
+(要求一个 __smart_pointer__ (智能指针)必须有符合要求的构造函数,比如 __boost__shared_ptr__)。

 If a third template argument is `factory_passes_alloc_to_smart_pointer`,
the allocator itself is used for the third constructor argument of `Pointer`
 (__boost__shared_ptr__ then uses the allocator to manage the memory of its
 seperately allocated reference counter).\n
-若给定了 `factory_passes_alloc_to_smart_pointer` 作为第三个模板参数,则
-allocator(分配器)本身将作为第三个参数传递给 `Pointer` 类 (__boost__shared_ptr__
-将使用此 allocator(分配器)用于其进行引用计数器的独立分配的内存的管理)。
+若给定了 `factory_passes_alloc_to_smart_pointer` 作为第三个模板参数(预定义 的一个枚举), +则allocator(分配器)本身将作为第三个参数传递给 `Pointer` 类 (__boost__shared_ptr__
+将使用此 allocator(分配器)用其进行对引用计数器的独立分配的内存的管理)。

 [heading Header(头文件)]
     #include <boost/functional/factory.hpp>

Other related posts:

  • » [boost-doc-zh] r412 committed - 修改部分语句令其更通顺,美化排版 - boost-doc-zh