• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Struct template vararg</title>
6<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9<link rel="up" href="../../proto/reference.html#header.boost.proto.matches_hpp" title="Header &lt;boost/proto/matches.hpp&gt;">
10<link rel="prev" href="convertible_to.html" title="Struct template convertible_to">
11<link rel="next" href="matches.html" title="Struct template matches">
12</head>
13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14<table cellpadding="2" width="100%"><tr>
15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
16<td align="center"><a href="../../../../index.html">Home</a></td>
17<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20<td align="center"><a href="../../../../more/index.htm">More</a></td>
21</tr></table>
22<hr>
23<div class="spirit-nav">
24<a accesskey="p" href="convertible_to.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.matches_hpp"><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="matches.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="refentry">
27<a name="boost.proto.vararg"></a><div class="titlepage"></div>
28<div class="refnamediv">
29<h2><span class="refentrytitle">Struct template vararg</span></h2>
30<p>boost::proto::vararg — For matching a Grammar to a variable number of sub-expressions.</p>
31</div>
32<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
33<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../proto/reference.html#header.boost.proto.matches_hpp" title="Header &lt;boost/proto/matches.hpp&gt;">boost/proto/matches.hpp</a>&gt;
34
35</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Grammar<span class="special">&gt;</span>
36<span class="keyword">struct</span> <a class="link" href="vararg.html" title="Struct template vararg">vararg</a> <span class="special">{</span>
37<span class="special">}</span><span class="special">;</span></pre></div>
38<div class="refsect1">
39<a name="id-1.3.33.5.34.12.4"></a><h2>Description</h2>
40<p>
41            An expression type <code class="computeroutput"><a class="link" href="basic_expr.html" title="Struct template basic_expr">proto::basic_expr</a>&lt;AT,
42            <a class="link" href="listN.html" title="Struct template listN">proto::listN</a>&lt;A<sub>0</sub>,...A<sub>n</sub>,U<sub>0</sub>,...U<sub>m</sub>&gt; &gt;</code>
43            matches a grammar <code class="computeroutput"><a class="link" href="basic_expr.html" title="Struct template basic_expr">proto::basic_expr</a>&lt;BT,
44            <a class="link" href="listN.html" title="Struct template listN">proto::listM</a>&lt;B<sub>0</sub>,...B<sub>n</sub>,proto::vararg&lt;V&gt; &gt; &gt;</code>
45            if <code class="computeroutput">BT</code> is <code class="computeroutput"><a class="link" href="_.html" title="Struct _">proto::_</a></code>
46            or <code class="computeroutput">AT</code>, and if
47            <code class="computeroutput">A<sub>x</sub></code> matches
48            <code class="computeroutput">B<sub>x</sub></code>
49            for each <code class="computeroutput">x</code> in <code class="computeroutput">[0,n]</code>
50            and if <code class="computeroutput">U<sub>x</sub></code> matches
51            <code class="computeroutput">V</code> for each <code class="computeroutput">x</code> in <code class="computeroutput">[0,m]</code>.
52          </p>
53<p>For example:</p>
54<p>
55            </p>
56<pre class="programlisting"><span class="comment">// Match any function call expression, regardless</span>
57<span class="comment">// of the number of function arguments:</span>
58<span class="keyword">struct</span> <span class="identifier">Function</span> <span class="special">:</span>
59  <a class="link" href="function.html" title="Struct template function">proto::function</a><span class="special">&lt;</span> <span class="identifier">proto</span><span class="special">::</span><span class="identifier">vararg</span><span class="special">&lt;</span><span class="identifier">proto</span><span class="special">::</span><span class="identifier">_</span><span class="special">&gt;</span> <span class="special">&gt;</span>
60<span class="special">{</span><span class="special">}</span><span class="special">;</span></pre>
61<p>
62          </p>
63<p>
64            When used as a transform, <code class="computeroutput">proto::vararg&lt;G&gt;</code>
65            applies <code class="computeroutput">G</code>'s transform.
66          </p>
67</div>
68</div>
69<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
70<td align="left"></td>
71<td align="right"><div class="copyright-footer">Copyright © 2008 Eric Niebler<p>
72        Distributed under the Boost Software License, Version 1.0. (See accompanying
73        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>)
74      </p>
75</div></td>
76</tr></table>
77<hr>
78<div class="spirit-nav">
79<a accesskey="p" href="convertible_to.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.matches_hpp"><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="matches.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
80</div>
81</body>
82</html>
83