• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>filter_view</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="../view.html" title="View">
9<link rel="prev" href="single_view.html" title="single_view">
10<link rel="next" href="iterator_range.html" title="iterator_range">
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="single_view.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../view.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="iterator_range.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="fusion.view.filter_view"></a><a class="link" href="filter_view.html" title="filter_view">filter_view</a>
28</h3></div></div></div>
29<h5>
30<a name="fusion.view.filter_view.h0"></a>
31        <span class="phrase"><a name="fusion.view.filter_view.description"></a></span><a class="link" href="filter_view.html#fusion.view.filter_view.description">Description</a>
32      </h5>
33<p>
34        <code class="computeroutput"><span class="identifier">filter_view</span></code> is a view into
35        a subset of its underlying sequence's elements satisfying a given predicate
36        (an <a href="http://www.boost.org/libs/mpl" target="_top">MPL</a> metafunction).
37        The <code class="computeroutput"><span class="identifier">filter_view</span></code> presents
38        only those elements for which its predicate evaluates to <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code>.
39      </p>
40<h5>
41<a name="fusion.view.filter_view.h1"></a>
42        <span class="phrase"><a name="fusion.view.filter_view.header"></a></span><a class="link" href="filter_view.html#fusion.view.filter_view.header">Header</a>
43      </h5>
44<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">view</span><span class="special">/</span><span class="identifier">filter_view</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
45<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">filter_view</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
46</pre>
47<h5>
48<a name="fusion.view.filter_view.h2"></a>
49        <span class="phrase"><a name="fusion.view.filter_view.synopsis"></a></span><a class="link" href="filter_view.html#fusion.view.filter_view.synopsis">Synopsis</a>
50      </h5>
51<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">,</span> <span class="keyword">typename</span> <span class="identifier">Pred</span><span class="special">&gt;</span>
52<span class="keyword">struct</span> <span class="identifier">filter_view</span><span class="special">;</span>
53</pre>
54<h5>
55<a name="fusion.view.filter_view.h3"></a>
56        <span class="phrase"><a name="fusion.view.filter_view.template_parameters"></a></span><a class="link" href="filter_view.html#fusion.view.filter_view.template_parameters">Template
57        parameters</a>
58      </h5>
59<div class="informaltable"><table class="table">
60<colgroup>
61<col>
62<col>
63<col>
64</colgroup>
65<thead><tr>
66<th>
67                <p>
68                  Parameter
69                </p>
70              </th>
71<th>
72                <p>
73                  Description
74                </p>
75              </th>
76<th>
77                <p>
78                  Default
79                </p>
80              </th>
81</tr></thead>
82<tbody>
83<tr>
84<td>
85                <p>
86                  <code class="computeroutput"><span class="identifier">Sequence</span></code>
87                </p>
88              </td>
89<td>
90                <p>
91                  A <a class="link" href="../sequence/concepts/forward_sequence.html" title="Forward Sequence">Forward
92                  Sequence</a>
93                </p>
94              </td>
95<td>
96              </td>
97</tr>
98<tr>
99<td>
100                <p>
101                  <code class="computeroutput"><span class="identifier">Pred</span></code>
102                </p>
103              </td>
104<td>
105                <p>
106                  A unary <a href="http://www.boost.org/libs/mpl/doc/refmanual/lambda-expression.html" target="_top">MPL
107                  Lambda Expression</a>
108                </p>
109              </td>
110<td>
111              </td>
112</tr>
113</tbody>
114</table></div>
115<h5>
116<a name="fusion.view.filter_view.h4"></a>
117        <span class="phrase"><a name="fusion.view.filter_view.model_of"></a></span><a class="link" href="filter_view.html#fusion.view.filter_view.model_of">Model
118        of</a>
119      </h5>
120<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
121<li class="listitem">
122            <a class="link" href="../sequence/concepts/forward_sequence.html" title="Forward Sequence">Forward Sequence</a>
123          </li>
124<li class="listitem">
125            <a class="link" href="../sequence/concepts/associative_sequence.html" title="Associative Sequence">Associative
126            Sequence</a> if <code class="computeroutput"><span class="identifier">Sequence</span></code>
127            implements the <a class="link" href="../sequence/concepts/associative_sequence.html" title="Associative Sequence">Associative
128            Sequence</a> model.
129          </li>
130</ul></div>
131<div class="variablelist">
132<p class="title"><b>Notation</b></p>
133<dl class="variablelist">
134<dt><span class="term"><code class="computeroutput"><span class="identifier">F</span></code></span></dt>
135<dd><p>
136              A <code class="computeroutput"><span class="identifier">filter_view</span></code> type
137            </p></dd>
138<dt><span class="term"><code class="computeroutput"><span class="identifier">f</span></code>, <code class="computeroutput"><span class="identifier">f2</span></code></span></dt>
139<dd><p>
140              Instances of <code class="computeroutput"><span class="identifier">filter_view</span></code>
141            </p></dd>
142<dt><span class="term"><code class="computeroutput"><span class="identifier">s</span></code></span></dt>
143<dd><p>
144              A <a class="link" href="../sequence/concepts/forward_sequence.html" title="Forward Sequence">Forward
145              Sequence</a>
146            </p></dd>
147</dl>
148</div>
149<h5>
150<a name="fusion.view.filter_view.h5"></a>
151        <span class="phrase"><a name="fusion.view.filter_view.expression_semantics"></a></span><a class="link" href="filter_view.html#fusion.view.filter_view.expression_semantics">Expression
152        Semantics</a>
153      </h5>
154<p>
155        Semantics of an expression is defined only where it differs from, or is not
156        defined in the implemented models.
157      </p>
158<div class="informaltable"><table class="table">
159<colgroup>
160<col>
161<col>
162</colgroup>
163<thead><tr>
164<th>
165                <p>
166                  Expression
167                </p>
168              </th>
169<th>
170                <p>
171                  Semantics
172                </p>
173              </th>
174</tr></thead>
175<tbody>
176<tr>
177<td>
178                <p>
179                  <code class="computeroutput"><span class="identifier">F</span><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
180                </p>
181              </td>
182<td>
183                <p>
184                  Creates a <code class="computeroutput"><span class="identifier">filter_view</span></code>
185                  given a sequence, <code class="computeroutput"><span class="identifier">s</span></code>.
186                </p>
187              </td>
188</tr>
189<tr>
190<td>
191                <p>
192                  <code class="computeroutput"><span class="identifier">F</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span></code>
193                </p>
194              </td>
195<td>
196                <p>
197                  Copy constructs a <code class="computeroutput"><span class="identifier">filter_view</span></code>
198                  from another <code class="computeroutput"><span class="identifier">filter_view</span></code>,
199                  <code class="computeroutput"><span class="identifier">f</span></code>.
200                </p>
201              </td>
202</tr>
203<tr>
204<td>
205                <p>
206                  <code class="computeroutput"><span class="identifier">f</span> <span class="special">=</span>
207                  <span class="identifier">f2</span></code>
208                </p>
209              </td>
210<td>
211                <p>
212                  Assigns to a <code class="computeroutput"><span class="identifier">filter_view</span></code>,
213                  <code class="computeroutput"><span class="identifier">f</span></code>, from another
214                  <code class="computeroutput"><span class="identifier">filter_view</span></code>, <code class="computeroutput"><span class="identifier">f2</span></code>.
215                </p>
216              </td>
217</tr>
218</tbody>
219</table></div>
220<h5>
221<a name="fusion.view.filter_view.h6"></a>
222        <span class="phrase"><a name="fusion.view.filter_view.example"></a></span><a class="link" href="filter_view.html#fusion.view.filter_view.example">Example</a>
223      </h5>
224<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">_</span><span class="special">;</span>
225<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">not_</span><span class="special">;</span>
226<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_class</span><span class="special">;</span>
227
228<span class="keyword">typedef</span> <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="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">char</span><span class="special">,</span> <span class="keyword">long</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">,</span> <span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">vector_type</span><span class="special">;</span>
229
230<span class="identifier">vector_type</span> <span class="identifier">v</span><span class="special">(</span><span class="string">"a-string"</span><span class="special">,</span> <span class="char">'@'</span><span class="special">,</span> <span class="number">987654</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="number">6.6</span><span class="special">);</span>
231<span class="identifier">filter_view</span><span class="special">&lt;</span><span class="identifier">vector_type</span> <span class="keyword">const</span><span class="special">,</span> <span class="identifier">not_</span><span class="special">&lt;</span><span class="identifier">is_class</span><span class="special">&lt;</span><span class="identifier">_</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">view</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
232<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">view</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
233</pre>
234</div>
235<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
236<td align="left"></td>
237<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman,
238      Dan Marsden, Tobias Schwinger<p>
239        Distributed under the Boost Software License, Version 1.0. (See accompanying
240        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>)
241      </p>
242</div></td>
243</tr></table>
244<hr>
245<div class="spirit-nav">
246<a accesskey="p" href="single_view.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../view.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="iterator_range.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
247</div>
248</body>
249</html>
250