Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / fusion / doc / html / fusion / sequence / intrinsic / functions / front.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>front</title>
5 <link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7 <link rel="home" href="../../../../index.html" title="Chapter&#160;1.&#160;Fusion 2.2">
8 <link rel="up" href="../functions.html" title="Functions">
9 <link rel="prev" href="empty.html" title="empty">
10 <link rel="next" href="back.html" title="back">
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="empty.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="back.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.front"></a><a class="link" href="front.html" title="front">front</a>
28 </h5></div></div></div>
29 <h6>
30 <a name="fusion.sequence.intrinsic.functions.front.h0"></a>
31             <span class="phrase"><a name="fusion.sequence.intrinsic.functions.front.description"></a></span><a class="link" href="front.html#fusion.sequence.intrinsic.functions.front.description">Description</a>
32           </h6>
33 <p>
34             Returns the first element in the sequence.
35           </p>
36 <h6>
37 <a name="fusion.sequence.intrinsic.functions.front.h1"></a>
38             <span class="phrase"><a name="fusion.sequence.intrinsic.functions.front.synopsis"></a></span><a class="link" href="front.html#fusion.sequence.intrinsic.functions.front.synopsis">Synopsis</a>
39           </h6>
40 <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Sequence</span><span class="special">&gt;</span>
41 <span class="keyword">typename</span> <a class="link" href="../metafunctions/front.html" title="front"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">front</span></code></a><span class="special">&lt;</span><span class="identifier">Sequence</span><span class="special">&gt;::</span><span class="identifier">type</span>
42 <span class="identifier">front</span><span class="special">(</span><span class="identifier">Sequence</span><span class="special">&amp;</span> <span class="identifier">seq</span><span class="special">);</span>
43
44 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Sequence</span><span class="special">&gt;</span>
45 <span class="keyword">typename</span> <a class="link" href="../metafunctions/front.html" title="front"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">front</span></code></a><span class="special">&lt;</span><span class="identifier">Sequence</span> <span class="keyword">const</span><span class="special">&gt;::</span><span class="identifier">type</span>
46 <span class="identifier">front</span><span class="special">(</span><span class="identifier">Sequence</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">seq</span><span class="special">);</span>
47 </pre>
48 <h6>
49 <a name="fusion.sequence.intrinsic.functions.front.h2"></a>
50             <span class="phrase"><a name="fusion.sequence.intrinsic.functions.front.parameters"></a></span><a class="link" href="front.html#fusion.sequence.intrinsic.functions.front.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 investigate.
90                     </p>
91                   </td>
92 </tr></tbody>
93 </table></div>
94 <h6>
95 <a name="fusion.sequence.intrinsic.functions.front.h3"></a>
96             <span class="phrase"><a name="fusion.sequence.intrinsic.functions.front.expression_semantics"></a></span><a class="link" href="front.html#fusion.sequence.intrinsic.functions.front.expression_semantics">Expression
97             Semantics</a>
98           </h6>
99 <pre class="programlisting"><span class="identifier">front</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>: Returns a reference to
103             the first element in the sequence <code class="computeroutput"><span class="identifier">seq</span></code>
104             if <code class="computeroutput"><span class="identifier">seq</span></code> is mutable and
105             <code class="computeroutput"><span class="identifier">e</span> <span class="special">=</span>
106             <span class="identifier">o</span></code>, where <code class="computeroutput"><span class="identifier">e</span></code>
107             is the first element in the sequence, is a valid expression. Else, returns
108             a type convertable to the first element in the sequence.
109           </p>
110 <p>
111             <span class="bold"><strong>Precondition</strong></span>: <code class="computeroutput"><a class="link" href="empty.html" title="empty"><code class="computeroutput"><span class="identifier">empty</span></code></a><span class="special">(</span><span class="identifier">seq</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">false</span></code>
112           </p>
113 <p>
114             <span class="bold"><strong>Semantics</strong></span>: Returns the first element
115             in the sequence.
116           </p>
117 <h6>
118 <a name="fusion.sequence.intrinsic.functions.front.h4"></a>
119             <span class="phrase"><a name="fusion.sequence.intrinsic.functions.front.header"></a></span><a class="link" href="front.html#fusion.sequence.intrinsic.functions.front.header">Header</a>
120           </h6>
121 <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</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">front</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
122 <span class="preprocessor">#include</span> <span class="special">&lt;</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">front</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
123 </pre>
124 <h6>
125 <a name="fusion.sequence.intrinsic.functions.front.h5"></a>
126             <span class="phrase"><a name="fusion.sequence.intrinsic.functions.front.example"></a></span><a class="link" href="front.html#fusion.sequence.intrinsic.functions.front.example">Example</a>
127           </h6>
128 <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">&lt;</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">&gt;</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>
129 <span class="identifier">assert</span><span class="special">(</span><span class="identifier">front</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>
130 </pre>
131 </div>
132 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
133 <td align="left"></td>
134 <td align="right"><div class="copyright-footer">Copyright &#169; 2001-2006, 2011, 2012 Joel de Guzman,
135       Dan Marsden, Tobias Schwinger<p>
136         Distributed under the Boost Software License, Version 1.0. (See accompanying
137         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>)
138       </p>
139 </div></td>
140 </tr></table>
141 <hr>
142 <div class="spirit-nav">
143 <a accesskey="p" href="empty.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="back.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
144 </div>
145 </body>
146 </html>