optional_last_value.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE header PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
  3. "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
  4. <!--
  5. Copyright Douglas Gregor 2001-2004
  6. Copyright Frank Mori Hess 2007-2009
  7. Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. -->
  10. <header name="boost/signals2/optional_last_value.hpp" last-revision="$Date: 2007-03-06 16:51:55 -0500 (Tue, 06 Mar 2007) $">
  11. <namespace name="boost">
  12. <namespace name="signals2">
  13. <class name="optional_last_value">
  14. <template>
  15. <template-type-parameter name="T"/>
  16. </template>
  17. <purpose>Evaluate an <conceptname>InputIterator</conceptname> sequence and return
  18. a boost::optional which contains the last value in the sequence, or an
  19. empty <classname>boost::optional</classname> if the sequence was empty.</purpose>
  20. <description>
  21. <para>
  22. <code>optional_last_value</code> is the default Combiner template type for signals in the
  23. Boost.Signals2 library. The advantage of <code>optional_last_value</code> over
  24. <classname>signals2::last_value</classname> is that <code>optional_last_value</code>
  25. can return an empty <classname>boost::optional</classname>. rather
  26. than throwing an exception, when
  27. its <code>InputIterator</code> sequence is empty.
  28. </para>
  29. </description>
  30. <typedef name="result_type"><type><classname>boost::optional</classname>&lt;T&gt;</type></typedef>
  31. <method-group name="invocation">
  32. <method name="operator()" cv="const">
  33. <template>
  34. <template-type-parameter name="InputIterator"/>
  35. </template>
  36. <type>result_type</type>
  37. <parameter name="first">
  38. <paramtype>InputIterator</paramtype>
  39. </parameter>
  40. <parameter name="last">
  41. <paramtype>InputIterator</paramtype>
  42. </parameter>
  43. <effects><para>Attempts to dereference every iterator in the sequence <computeroutput>[first, last)</computeroutput>.
  44. </para></effects>
  45. <returns>
  46. <para>
  47. The result of the last successful iterator dereference, wrapped in a <classname>boost::optional</classname>.
  48. The returned <code>optional</code> will be empty if no iterators were dereferenced.
  49. </para>
  50. </returns>
  51. <throws><para>Does not throw.</para></throws>
  52. </method>
  53. </method-group>
  54. </class>
  55. <class-specialization name="optional_last_value">
  56. <template/>
  57. <specialization>
  58. <template-arg>void</template-arg>
  59. </specialization>
  60. <purpose>Evaluate an InputIterator sequence.</purpose>
  61. <description>
  62. <para>This specialization of <classname>signals2::optional_last_value</classname> is provided
  63. to cope with the fact that there is no such thing as an
  64. <code><classname>optional</classname>&lt;void&gt;</code>, which
  65. <classname>optional_last_value</classname> would otherwise try to
  66. use as its <code>result_type</code>. This specialization
  67. instead sets the <code>result_type</code> to be <code>void</code>.
  68. </para>
  69. </description>
  70. <typedef name="result_type">
  71. <type>void</type>
  72. </typedef>
  73. <method-group name="invocation">
  74. <method name="operator()" cv="const">
  75. <template>
  76. <template-type-parameter name="InputIterator"/>
  77. </template>
  78. <type>result_type</type>
  79. <parameter name="first">
  80. <paramtype>InputIterator</paramtype>
  81. </parameter>
  82. <parameter name="last">
  83. <paramtype>InputIterator</paramtype>
  84. </parameter>
  85. <effects><para>Attempts to dereference every iterator in the sequence <computeroutput>[first, last)</computeroutput>.
  86. </para></effects>
  87. </method>
  88. </method-group>
  89. </class-specialization>
  90. </namespace>
  91. </namespace>
  92. </header>