1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>begin</title> 5<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../../../index.html" title="Chapter 1. Fusion 2.2"> 8<link rel="up" href="../functions.html" title="Functions"> 9<link rel="prev" href="../functions.html" title="Functions"> 10<link rel="next" href="end.html" title="end"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="../functions.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../functions.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="end.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h5 class="title"> 27<a name="fusion.sequence.intrinsic.functions.begin"></a><a class="link" href="begin.html" title="begin">begin</a> 28</h5></div></div></div> 29<h6> 30<a name="fusion.sequence.intrinsic.functions.begin.h0"></a> 31 <span class="phrase"><a name="fusion.sequence.intrinsic.functions.begin.description"></a></span><a class="link" href="begin.html#fusion.sequence.intrinsic.functions.begin.description">Description</a> 32 </h6> 33<p> 34 Returns an iterator pointing to the first element in the sequence. 35 </p> 36<h6> 37<a name="fusion.sequence.intrinsic.functions.begin.h1"></a> 38 <span class="phrase"><a name="fusion.sequence.intrinsic.functions.begin.synopsis"></a></span><a class="link" href="begin.html#fusion.sequence.intrinsic.functions.begin.synopsis">Synopsis</a> 39 </h6> 40<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Sequence</span><span class="special">></span> 41<span class="keyword">typename</span> <a class="link" href="../metafunctions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">begin</span></code></a><span class="special"><</span><span class="identifier">Sequence</span><span class="special">>::</span><span class="identifier">type</span> 42<span class="identifier">begin</span><span class="special">(</span><span class="identifier">Sequence</span><span class="special">&</span> <span class="identifier">seq</span><span class="special">);</span> 43 44<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Sequence</span><span class="special">></span> 45<span class="keyword">typename</span> <a class="link" href="../metafunctions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">begin</span></code></a><span class="special"><</span><span class="identifier">Sequence</span> <span class="keyword">const</span><span class="special">>::</span><span class="identifier">type</span> 46<span class="identifier">begin</span><span class="special">(</span><span class="identifier">Sequence</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">seq</span><span class="special">);</span> 47</pre> 48<h6> 49<a name="fusion.sequence.intrinsic.functions.begin.h2"></a> 50 <span class="phrase"><a name="fusion.sequence.intrinsic.functions.begin.parameters"></a></span><a class="link" href="begin.html#fusion.sequence.intrinsic.functions.begin.parameters">Parameters</a> 51 </h6> 52<div class="informaltable"><table class="table"> 53<colgroup> 54<col> 55<col> 56<col> 57</colgroup> 58<thead><tr> 59<th> 60 <p> 61 Parameter 62 </p> 63 </th> 64<th> 65 <p> 66 Requirement 67 </p> 68 </th> 69<th> 70 <p> 71 Description 72 </p> 73 </th> 74</tr></thead> 75<tbody><tr> 76<td> 77 <p> 78 <code class="computeroutput"><span class="identifier">seq</span></code> 79 </p> 80 </td> 81<td> 82 <p> 83 Model of <a class="link" href="../../concepts/forward_sequence.html" title="Forward Sequence">Forward 84 Sequence</a> 85 </p> 86 </td> 87<td> 88 <p> 89 The sequence we wish to get an iterator from. 90 </p> 91 </td> 92</tr></tbody> 93</table></div> 94<h6> 95<a name="fusion.sequence.intrinsic.functions.begin.h3"></a> 96 <span class="phrase"><a name="fusion.sequence.intrinsic.functions.begin.expression_semantics"></a></span><a class="link" href="begin.html#fusion.sequence.intrinsic.functions.begin.expression_semantics">Expression 97 Semantics</a> 98 </h6> 99<pre class="programlisting"><span class="identifier">begin</span><span class="special">(</span><span class="identifier">seq</span><span class="special">);</span> 100</pre> 101<p> 102 <span class="bold"><strong>Return type</strong></span>: 103 </p> 104<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 105<li class="listitem"> 106 A model of <a class="link" href="../../../iterator/concepts/forward_iterator.html" title="Forward Iterator">Forward 107 Iterator</a> if <code class="computeroutput"><span class="identifier">seq</span></code> 108 is a <a class="link" href="../../concepts/forward_sequence.html" title="Forward Sequence">Forward 109 Sequence</a> else, <a class="link" href="../../../iterator/concepts/bidirectional_iterator.html" title="Bidirectional Iterator">Bidirectional 110 Iterator</a> if <code class="computeroutput"><span class="identifier">seq</span></code> 111 is a <a class="link" href="../../concepts/bidirectional_sequence.html" title="Bidirectional Sequence">Bidirectional 112 Sequence</a> else, <a class="link" href="../../../iterator/concepts/random_access_iterator.html" title="Random Access Iterator">Random 113 Access Iterator</a> if <code class="computeroutput"><span class="identifier">seq</span></code> 114 is a <a class="link" href="../../concepts/random_access_sequence.html" title="Random Access Sequence">Random 115 Access Sequence</a>. 116 </li> 117<li class="listitem"> 118 A model of <a class="link" href="../../../iterator/concepts/associative_iterator.html" title="Associative Iterator">Associative 119 Iterator</a> if <code class="computeroutput"><span class="identifier">seq</span></code> 120 is an <a class="link" href="../../concepts/associative_sequence.html" title="Associative Sequence">Associative 121 Sequence</a>. 122 </li> 123</ul></div> 124<p> 125 <span class="bold"><strong>Semantics</strong></span>: Returns an iterator pointing 126 to the first element in the sequence. 127 </p> 128<h6> 129<a name="fusion.sequence.intrinsic.functions.begin.h4"></a> 130 <span class="phrase"><a name="fusion.sequence.intrinsic.functions.begin.header"></a></span><a class="link" href="begin.html#fusion.sequence.intrinsic.functions.begin.header">Header</a> 131 </h6> 132<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">sequence</span><span class="special">/</span><span class="identifier">intrinsic</span><span class="special">/</span><span class="identifier">begin</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 133<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">begin</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 134</pre> 135<h6> 136<a name="fusion.sequence.intrinsic.functions.begin.h5"></a> 137 <span class="phrase"><a name="fusion.sequence.intrinsic.functions.begin.example"></a></span><a class="link" href="begin.html#fusion.sequence.intrinsic.functions.begin.example">Example</a> 138 </h6> 139<pre class="programlisting"><a class="link" href="../../../container/vector.html" title="vector"><code class="computeroutput"><span class="identifier">vector</span></code></a><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">></span> <span class="identifier">v</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span> 140<span class="identifier">assert</span><span class="special">(</span><a class="link" href="../../../iterator/functions/deref.html" title="deref"><code class="computeroutput"><span class="identifier">deref</span></code></a><span class="special">(</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">v</span><span class="special">))</span> <span class="special">==</span> <span class="number">1</span><span class="special">);</span> 141</pre> 142</div> 143<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 144<td align="left"></td> 145<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman, 146 Dan Marsden, Tobias Schwinger<p> 147 Distributed under the Boost Software License, Version 1.0. (See accompanying 148 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 149 </p> 150</div></td> 151</tr></table> 152<hr> 153<div class="spirit-nav"> 154<a accesskey="p" href="../functions.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../functions.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="end.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 155</div> 156</body> 157</html> 158