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<!-- 5Copyright Douglas Gregor 2001-2004 6Copyright Frank Mori Hess 2007-2009 7 8Distributed under the Boost Software License, Version 1.0. (See accompanying 9file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10--> 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"> 15 <template> 16 <template-type-parameter name="T"/> 17 </template> 18 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> 22 <description> 23 <para> 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. 30 </para> 31 </description> 32 33 <typedef name="result_type"><type><classname>boost::optional</classname><T></type></typedef> 34 35 <method-group name="invocation"> 36 <method name="operator()" cv="const"> 37 <template> 38 <template-type-parameter name="InputIterator"/> 39 </template> 40 <type>result_type</type> 41 <parameter name="first"> 42 <paramtype>InputIterator</paramtype> 43 </parameter> 44 <parameter name="last"> 45 <paramtype>InputIterator</paramtype> 46 </parameter> 47 48 <effects><para>Attempts to dereference every iterator in the sequence <computeroutput>[first, last)</computeroutput>. 49 </para></effects> 50 <returns> 51 <para> 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. 54 </para> 55 </returns> 56 <throws><para>Does not throw.</para></throws> 57 </method> 58 </method-group> 59 </class> 60 61 <class-specialization name="optional_last_value"> 62 <template/> 63 <specialization> 64 <template-arg>void</template-arg> 65 </specialization> 66 67 <purpose>Evaluate an InputIterator sequence.</purpose> 68 <description> 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>. 75 </para> 76 </description> 77 78 <typedef name="result_type"> 79 <type>void</type> 80 </typedef> 81 82 <method-group name="invocation"> 83 <method name="operator()" cv="const"> 84 <template> 85 <template-type-parameter name="InputIterator"/> 86 </template> 87 <type>result_type</type> 88 <parameter name="first"> 89 <paramtype>InputIterator</paramtype> 90 </parameter> 91 <parameter name="last"> 92 <paramtype>InputIterator</paramtype> 93 </parameter> 94 95 <effects><para>Attempts to dereference every iterator in the sequence <computeroutput>[first, last)</computeroutput>. 96 </para></effects> 97 </method> 98 </method-group> 99 </class-specialization> 100 </namespace> 101 </namespace> 102</header> 103