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">
5 Copyright Douglas Gregor 2001-2004
6 Copyright Frank Mori Hess 2007-2009
8 Distributed under the Boost Software License, Version 1.0. (See accompanying
9 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 <header name=
"boost/signals2/optional_last_value.hpp" last-revision=
"$Date: 2007-03-06 16:51:55 -0500 (Tue, 06 Mar 2007) $">
12 <namespace name=
"boost">
13 <namespace name=
"signals2">
14 <class name=
"optional_last_value">
16 <template-type-parameter name=
"T"/>
19 <purpose>Evaluate an
<conceptname>InputIterator
</conceptname> sequence and return
20 a boost::optional which contains the last value in the sequence, or an
21 empty
<classname>boost::optional
</classname> if the sequence was empty.
</purpose>
24 <code>optional_last_value
</code> is the default Combiner template type for signals in the
25 Boost.Signals2 library. The advantage of
<code>optional_last_value
</code> over
26 <classname>signals2::last_value
</classname> is that
<code>optional_last_value
</code>
27 can return an empty
<classname>boost::optional
</classname>. rather
28 than throwing an exception, when
29 its
<code>InputIterator
</code> sequence is empty.
33 <typedef name=
"result_type"><type><classname>boost::optional
</classname><T
></type></typedef>
35 <method-group name=
"invocation">
36 <method name=
"operator()" cv=
"const">
38 <template-type-parameter name=
"InputIterator"/>
40 <type>result_type
</type>
41 <parameter name=
"first">
42 <paramtype>InputIterator
</paramtype>
44 <parameter name=
"last">
45 <paramtype>InputIterator
</paramtype>
48 <effects><para>Attempts to dereference every iterator in the sequence
<computeroutput>[first, last)
</computeroutput>.
52 The result of the last successful iterator dereference, wrapped in a
<classname>boost::optional
</classname>.
53 The returned
<code>optional
</code> will be empty if no iterators were dereferenced.
56 <throws><para>Does not throw.
</para></throws>
61 <class-specialization name=
"optional_last_value">
64 <template-arg>void
</template-arg>
67 <purpose>Evaluate an InputIterator sequence.
</purpose>
69 <para>This specialization of
<classname>signals2::optional_last_value
</classname> is provided
70 to cope with the fact that there is no such thing as an
71 <code><classname>optional
</classname><void
></code>, which
72 <classname>optional_last_value
</classname> would otherwise try to
73 use as its
<code>result_type
</code>. This specialization
74 instead sets the
<code>result_type
</code> to be
<code>void
</code>.
78 <typedef name=
"result_type">
82 <method-group name=
"invocation">
83 <method name=
"operator()" cv=
"const">
85 <template-type-parameter name=
"InputIterator"/>
87 <type>result_type
</type>
88 <parameter name=
"first">
89 <paramtype>InputIterator
</paramtype>
91 <parameter name=
"last">
92 <paramtype>InputIterator
</paramtype>
95 <effects><para>Attempts to dereference every iterator in the sequence
<computeroutput>[first, last)
</computeroutput>.
99 </class-specialization>