Commits

David Villa Alises committed bd32bb1

listados

  • Participants
  • Parent commits ae03bd4

Comments (0)

Files changed (3)

 
 	cp images/*.png $@/images
 	cp images/*.gif $@/images    # solo para incluir los dibujos originales
-	cp images/web/* $@/images/
+	cp images/web/* $@/images
 
 	-rm $@/*.css
 #	cp stylesheets/*.css $@/
 	ln -s ../stylesheets/chunk.css $@/
 	ln -s ../stylesheets/highlight.css $@/
 
-	xsltproc  --xinclude $(XSL_COMMON_OPTS) --output $@/$@.html $(SINGLE_XSL) $<
+#	xsltproc  --xinclude $(XSL_COMMON_OPTS) --output $@/$@.html $(SINGLE_XSL) $<
 	xsltproc  --xinclude $(XSL_COMMON_OPTS) --output $@ $(CHUNK_XSL) $<
 
 	grep -l BEGINCODE $@/*.html | xargs python utils/html_colorize.py
       one, or two arguments:
       -->
       <para>
-
+	La librería estándar clasifica un functor en función del número de argumentos de
+	su método y tipo de retorno de su método <function>operator()</function>. Esta
+	clasificación depende de si toma ninguno, uno o dos argumentos:
       </para>
 
       <!--
       apply generators to a sequence.
       -->
       <para>
-
+	Generador: Un tipo de functor que no toma ningún argumento y retorna un valor de
+	tipo arbitrario. Un generador de números aleatorios es un ejemplo de generador. La
+	librería estándar proporciona un generador, la función <function>rand()</function>
+	declarada en el fichero <filename>&lt;cstdlib></filename>, y tiene algunos
+	algoritmos, como <function>generate\_n()</function>, que aplica generadores a una
+	secuencia.
       </para>
 
       <!--
       type and returns a value that may be of a different type (which may be void).
       -->
       <para>
-
+	Función unaria: Un tipo de functor que toma un único argumento de cualquier tipo y
+	retorna un valor que puede ser de un tipo diferente (incluido <type>void</type>.
       </para>
 
       <!--
       importance of this concept will become clearer in the next chapter.
       -->
       <para>
-
+	Orden estricto débil: Un predicado binario que permite una implementación general
+	de <quote>igualdad</quote>. Algunos de los contenedores estándar consideran que
+	dos elementos son equivalentes si no es menor que el otro (usando el
+	<function>operator&lt;()</function>. Esto es importante cuando se comparas valores
+	flotantes, y objetos de otros tipos en los que el
+	<function>operator==()</function> no es fiable o no está disponible. Esto también
+	se aplica si quiere ordenar una secuencia de estructuras en un subconjunto de
+	campos de estructuras. Ese esquema de comparación se considera orden estricto
+	débil porque dos registros con las mismas claves no son realmente
+	<quote>iguales</quote> como objetos completos, pero son iguales respecto a la
+	comparación que está aplicando. La importancia del concepto se verá más clara en
+	el próximo capítulo.
       </para>
 
       <!--
 
       </para>
 
-      <!-- remove_copy_if(a, a + SIZE, o, b(g, 15).operator()); -->
-      <para>
-
-      </para>
+<programlisting>
+remove_copy_if(a, a + SIZE, o, b(g, 15).operator());
+</programlisting>
 
       <!--
       As remove_copy_if( ) iterates through the sequence, it calls b on each element,
 
       </para>
 
-      <!-- if(b(e)) -->
-      <para>
-
-      </para>
+<programlisting>
+if(b(e))
+</programlisting>
 
       <!--
       but binder2nd’s function call operator just turns around and calls g(e,15), so
 
       </para>
 
-      <!-- if(greater<int>(e, 15)) -->
-      <para>
-
-      </para>
+<programlisting>
+if(greater&lt;int>(e, 15))
+</programlisting>
 
       <!--
       which is the comparison we were seeking. There is also a bind1st( ) adaptor that
 
       </para>
 
-      <!-- if(n(e)) -->
-      <para>
-
-      </para>
+<programlisting>
+if(n(e))
+</programlisting>
 
       <!-- in the implementation of count_if is interpreted as -->
       <para>
 
       </para>
 
-      <!-- if(!bind1st(equal_to<int>, 20)(e)) -->
-      <para>
-
-      </para>
+<programlisting>
+if(!bind1st(equal_to&lt;int>, 20)(e))
+</programlisting>
 
       <!-- which ends up as -->
       <para>
 
       </para>
 
-      <!-- if(!equal_to<int>(20, e)) -->
-      <para>
-
-      </para>
+<programlisting>
+if(!equal_to&lt;int>(20, e))
+</programlisting>
 
       <!--
       because not1( ) returns the logical negation of the result of calling its unary
 
       </para>
 
-      <!-- not1(bind1st(equal_to<int>(), 20)) -->
-      <para>
-
-      </para>
+<programlisting>
+not1(bind1st(equal_to&lt;int>(), 20))
+</programlisting>
+
 
       <!--
       The bind1st( ) adaptor creates a unary function object of type binder1st, which
 
       </para>
 
-      <!--
-      template<class Op, class T>
-      binder1st<Op> bind1st(const Op& f, const T& val) {
-      typedef typename Op::first_argument_type Arg1_t;
-      return binder1st<Op>(f, Arg1_t(val));
-      }
-      -->
-      <para>
-
-      </para>
+<programlisting>
+template&lt;class Op, class T>
+binder1st&lt;Op> bind1st(const Op&amp; f, const T&amp; val) {
+  typedef typename Op::first_argument_type Arg1_t;
+  return binder1st&lt;Op>(f, Arg1_t(val));
+}
+</programlisting>
+
 
       <!--
       Note that the template parameter, Op, which represents the type of the binary
 
       </para>
 
-      <!--
-      // Inside the implementation for binder1st<Op>
-      typename Op::result_type
-      operator()(const typename Op::second_argument_type& x)
-      const;
-      -->
-      <para>
-
-      </para>
+<programlisting>
+// Inside the implementation for binder1st&lt;Op>
+typename Op::result_type
+operator()(const typename Op::second_argument_type&amp; x) const;
+</programlisting>
 
       <!--
       Function objects whose classes provide these type names are called adaptable
 
       </para>
 
-      <!--
-      class gt_n : public unary_function<int, bool> {
-      int value;
-      public:
-      gt_n(int val) : value(val) {}
-      bool operator()(int n) {
-      return n > value;
-      }
-      };
-      -->
-      <para>
-
-      </para>
+<programlisting>
+class gt_n : public unary_function&lt;int, bool> {
+  int value;
+public:
+  gt_n(int val) : value(val) {}
+  bool operator()(int n) {
+    return n > value;
+  }
+};
+</programlisting>
+
 
       <!--
       All unary_function does is to provide the appropriate type definitions, which it
 
       </para>
 
-      <!--
-      template<class Arg, class Result> struct unary_function {
-      typedef Arg argument_type;
-      typedef Result result_type;
-      };
-      -->
-      <para>
-
-      </para>
+<programlisting>
+template&lt;class Arg, class Result> struct unary_function {
+  typedef Arg argument_type;
+  typedef Result result_type;
+};
+</programlisting>
 
       <!--
       These types become accessible through gt_n because it derives publicly from
 
       </para>
 
-      <!-- bind2nd(plus<int>(), 1) -->
+      <!-- bind2nd(plus&lt;int>(), 1) -->
       <para>
 
       </para>
 
       </para>
 
-      <!--
-      x:
-      4 8 18 36 22 6 29 19 25 47
-      y:
-      4 14 23 9 11 32 13 15 44 30
-      After testBinary(x, y, r, plus<int>()):
-      8 22 41 45 33 38 42 34 69 77
-      After testBinary(x, y, r, minus<int>()):
-      0 -6 -5 27 11 -26 16 4 -19 17
-      After testBinary(x, y, r, multiplies<int>()):
-      16 112 414 324 242 192 377 285 1100 1410
-      After testBinary(x, y, r, divides<int>()):
-      1 0 0 4 2 0 2 1 0 1
-      After testBinary(x, y, r, limit<int>()):
-      0 8 18 0 0 6 3 4 25 17
-      After testUnary(x, r, negate<int>()):
-      -4 -8 -18 -36 -22 -6 -29 -19 -25 -47
-      After testBinary(x, y, br, equal_to<int>()):
-      1 0 0 0 0 0 0 0 0 0
-      After testBinary(x, y, br, not_equal_to<int>()):
-      0 1 1 1 1 1 1 1 1 1
-      After testBinary(x, y, br, greater<int>()):
-      0 0 0 1 1 0 1 1 0 1
-      After testBinary(x, y, br, less<int>()):
-      0 1 1 0 0 1 0 0 1 0
-      After testBinary(x, y, br, greater_equal<int>()):
-      1 0 0 1 1 0 1 1 0 1
-      After testBinary(x, y, br, less_equal<int>()):
-      1 1 1 0 0 1 0 0 1 0
-      After testBinary(x, y, br, not2(greater_equal<int>())):
-      0 1 1 0 0 1 0 0 1 0
-      After testBinary(x,y,br,not2(less_equal<int>())):
-      0 0 0 1 1 0 1 1 0 1
-      b1:
-      0 1 1 0 0 0 1 0 1 1
-      b2:
-      0 1 1 0 0 0 1 0 1 1
-      After testBinary(b1, b2, br, logical_and<int>()):
-      0 1 1 0 0 0 1 0 1 1
-      After testBinary(b1, b2, br, logical_or<int>()):
-      0 1 1 0 0 0 1 0 1 1
-      After testUnary(b1, br, logical_not<int>()):
-      1 0 0 1 1 1 0 1 0 0
-      After testUnary(b1, br, not1(logical_not<int>())):
-      0 1 1 0 0 0 1 0 1 1
-      -->
-      <para>
-
-      </para>
+<screen>
+x:
+4 8 18 36 22 6 29 19 25 47
+y:
+4 14 23 9 11 32 13 15 44 30
+After testBinary(x, y, r, plus&lt;int>()):
+8 22 41 45 33 38 42 34 69 77
+After testBinary(x, y, r, minus&lt;int>()):
+0 -6 -5 27 11 -26 16 4 -19 17
+After testBinary(x, y, r, multiplies&lt;int>()):
+16 112 414 324 242 192 377 285 1100 1410
+After testBinary(x, y, r, divides&lt;int>()):
+1 0 0 4 2 0 2 1 0 1
+After testBinary(x, y, r, limit&lt;int>()):
+0 8 18 0 0 6 3 4 25 17
+After testUnary(x, r, negate&lt;int>()):
+-4 -8 -18 -36 -22 -6 -29 -19 -25 -47
+After testBinary(x, y, br, equal_to&lt;int>()):
+1 0 0 0 0 0 0 0 0 0
+After testBinary(x, y, br, not_equal_to&lt;int>()):
+0 1 1 1 1 1 1 1 1 1
+After testBinary(x, y, br, greater&lt;int>()):
+0 0 0 1 1 0 1 1 0 1
+After testBinary(x, y, br, less&lt;int>()):
+0 1 1 0 0 1 0 0 1 0
+After testBinary(x, y, br, greater_equal&lt;int>()):
+1 0 0 1 1 0 1 1 0 1
+After testBinary(x, y, br, less_equal&lt;int>()):
+1 1 1 0 0 1 0 0 1 0
+After testBinary(x, y, br, not2(greater_equal&lt;int>())):
+0 1 1 0 0 1 0 0 1 0
+After testBinary(x,y,br,not2(less_equal&lt;int>())):
+0 0 0 1 1 0 1 1 0 1
+b1:
+0 1 1 0 0 0 1 0 1 1
+b2:
+0 1 1 0 0 0 1 0 1 1
+After testBinary(b1, b2, br, logical_and&lt;int>()):
+0 1 1 0 0 0 1 0 1 1
+After testBinary(b1, b2, br, logical_or&lt;int>()):
+0 1 1 0 0 0 1 0 1 1
+After testUnary(b1, br, logical_not&lt;int>()):
+1 0 0 1 1 1 0 1 0 0
+After testUnary(b1, br, not1(logical_not&lt;int>())):
+0 1 1 0 0 0 1 0 1 1
+</screen>
 
       <!--
       If you want the Boolean values to display as “true” and “false” instead of 1 and
 
       </para>
 
-      <!--
-      template<class Arg, class Result>
-      class pointer_to_unary_function
-      : public unary_function<Arg, Result> {
-      Result (*fptr)(Arg); // Stores the f-ptr
-      public:
-      pointer_to_unary_function(Result (*x)(Arg)) : fptr(x) {}
-      Result operator()(Arg x) const { return fptr(x); }
-      };
-      -->
-      <para>
-
-      </para>
+<programlisting>
+template&lt;class Arg, class Result>
+class pointer_to_unary_function
+: public unary_function&lt;Arg, Result> {
+  Result (*fptr)(Arg); // Stores the f-ptr
+public:
+  pointer_to_unary_function(Result (*x)(Arg)) : fptr(x) {}
+  Result operator()(Arg x) const { return fptr(x); }
+};
+</programlisting>
 
       <!--
       Since pointer_to_unary_function derives from unary_function, the appropriate
 
       </para>
 
-      <!--
-      template<class T>
-      struct iterator_traits<T*> {
-      typedef random_access_iterator_tag iterator_category;
-      typedef T value_type;
-      typedef ptrdiff_t difference_type;
-      typedef T* pointer;
-      typedef T& reference;
-      };
-      -->
-      <para>
-
-      </para>
+<programlisting>
+template&lt;class T>
+struct iterator_traits&lt;T*> {
+  typedef random_access_iterator_tag iterator_category;
+  typedef T value_type;
+  typedef ptrdiff_t difference_type;
+  typedef T* pointer;
+  typedef T&amp; reference;
+};
+</programlisting>
+
 
       <!--
       This makes the type of the elements pointed at (namely, T) available via the
 
       </para>
 
-      <!--
-      bool next_permutation(BidirectionalIterator first,
-      BidirectionalIterator last);
-      bool next_permutation(BidirectionalIterator first, BidirectionalIterator last, StrictWeakOrdering binary_pred);
-      bool prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
-      bool prev_permutation(BidirectionalIterator first, BidirectionalIterator last, StrictWeakOrdering binary_pred);
-      -->
-      <para>
-
-      </para>
+<programlisting>
+bool next_permutation(BidirectionalIterator first, BidirectionalIterator last);
+bool next_permutation(BidirectionalIterator first, BidirectionalIterator last,
+StrictWeakOrdering binary_pred);
+bool prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
+bool prev_permutation(BidirectionalIterator first, BidirectionalIterator last,
+StrictWeakOrdering binary_pred);
+</programlisting>
 
       <!--
       A permutation is one unique ordering of a set of elements. If you have n unique
 
     </para>
 
-    <programlisting>
+<programlisting>
 // Assumes pred is the incoming condition
 replace_copy_if(begin, end, not1(pred));
 </programlisting>

File master_Volumen2.xml

       </para>
     </partintro>
 
+<!--
      <xi:include href="V2-C01.ok.xml"/>
      <xi:include href="V2-C02.ok.xml"/>
-
+-->
   </part>
 
   <part>
       </para>
     </partintro>
 
+<!--
      <xi:include href="V2-C03.ok.xml"/>
      <xi:include href="V2-C04.ok.xml"/>
      <xi:include href="V2-C05.ok.xml"/>
+-->
      <xi:include href="V2-C06.ok.xml"/>
 <!-- <xi:include href="V2-C07.ok.xml"/> -->
   </part>
       </para>
     </partintro>
 
-<!-- <xi:include href="V2-C08.ok.xml"/> -->
+<!-- <xi:include href="V2-C08.ok.xml"/>
      <xi:include href="V2-C09.ok.xml"/>
      <xi:include href="V2-C10.ok.xml"/>
      <xi:include href="V2-C11.ok.xml"/>
+ -->
   </part>