1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
5 <title>Macro BOOST_PROTO_BASIC_EXTENDS</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.extends_hpp" title="Header <boost/proto/extends.hpp>">
10 <link rel="prev" href="BOOST_PROTO_EXTENDS.html" title="Macro BOOST_PROTO_EXTENDS">
11 <link rel="next" href="BOOST_PROTO_EXTENDS_ASSIGN.html" title="Macro BOOST_PROTO_EXTENDS_ASSIGN">
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>
23 <div class="spirit-nav">
24 <a accesskey="p" href="BOOST_PROTO_EXTENDS.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="proto/reference.html#header.boost.proto.extends_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="BOOST_PROTO_EXTENDS_ASSIGN.html"><img src="../../doc/src/images/next.png" alt="Next"></a>
26 <div class="refentry">
27 <a name="BOOST_PROTO_BASIC_EXTENDS"></a><div class="titlepage"></div>
28 <div class="refnamediv">
29 <h2><span class="refentrytitle">Macro BOOST_PROTO_BASIC_EXTENDS</span></h2>
30 <p>BOOST_PROTO_BASIC_EXTENDS — For creating expression wrappers that add members to a Proto expression template, like
31 <code class="computeroutput"><a class="link" href="boost/proto/extends.html" title="Struct template extends">proto::extends<></a></code>,
32 but while retaining POD-ness of the expression wrapper.</p>
34 <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
35 <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="proto/reference.html#header.boost.proto.extends_hpp" title="Header <boost/proto/extends.hpp>">boost/proto/extends.hpp</a>>
37 </span>BOOST_PROTO_BASIC_EXTENDS(Expr, Derived, Domain)</pre></div>
38 <div class="refsect1">
39 <a name="idp463554560"></a><h2>Description</h2>
41 <code class="computeroutput">BOOST_PROTO_BASIC_EXTENDS()</code> adds the basic typedefs, member functions, and
42 data members necessary to make a struct a valid Proto expression extension. It does <span class="emphasis"><em>not</em></span>
43 add any constructors, virtual functions or access control blocks that would render the containing
47 <code class="computeroutput">Expr</code> is the Proto expression that the enclosing struct extends.
48 <code class="computeroutput">Derived</code> is the type of the enclosing struct.
49 <code class="computeroutput">Domain</code> is the Proto domain to which this expression extension belongs.
50 (See <code class="computeroutput"><a class="link" href="boost/proto/domain.html" title="Struct template domain">proto::domain<></a></code>.)
51 Can be preceeded with "<code class="computeroutput">typename</code>" if the specified domain is a dependent type.
53 <p><code class="computeroutput">BOOST_PROTO_BASIC_EXTENDS()</code> adds to its enclosing struct
54 exactly one data member of type <code class="computeroutput">Expr</code>.
56 <p>If the <code class="computeroutput">Domain</code> parameter is dependent, you can specify it as
57 <code class="computeroutput">typename Domain</code>, as in
58 <code class="computeroutput">BOOST_PROTO_BASIC_EXTENDS(Expr, Derived, typename Domain)</code>
61 <span class="bold"><strong>Example:</strong></span></p>
62 <pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Expr</span> <span class="special">></span>
63 <span class="keyword">struct</span> <span class="identifier">my_expr</span><span class="special">;</span>
65 <span class="keyword">struct</span> <span class="identifier">my_domain</span>
66 <span class="special">:</span> <a class="link" href="boost/proto/domain.html" title="Struct template domain">proto::domain</a><span class="special"><</span> <a class="link" href="boost/proto/pod_generator.html" title="Struct template pod_generator">proto::pod_generator</a><span class="special"><</span> <span class="identifier">my_expr</span> <span class="special">></span> <span class="special">></span>
67 <span class="special">{</span><span class="special">}</span><span class="special">;</span>
69 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Expr</span> <span class="special">></span>
70 <span class="keyword">struct</span> <span class="identifier">my_expr</span>
71 <span class="special">{</span>
72 <span class="comment">// OK, this makes my_expr<> a valid Proto expression extension.</span>
73 <span class="comment">// my_expr<> does /not/ have overloaded assignment, subscript,</span>
74 <span class="comment">// and function call operators that build expression templates, however.</span>
75 <a class="link" href="BOOST_PROTO_BASIC_EXTENDS.html" title="Macro BOOST_PROTO_BASIC_EXTENDS">BOOST_PROTO_BASIC_EXTENDS</a><span class="special">(</span><span class="identifier">Expr</span><span class="special">,</span> <span class="identifier">my_expr</span><span class="special">,</span> <span class="identifier">my_domain</span><span class="special">)</span>
76 <span class="special">}</span><span class="special">;</span>
78 <span class="comment">// OK, my_expr<> is POD, so this is statically initialized:</span>
79 <span class="identifier">my_expr</span><span class="special"><</span> <a class="link" href="boost/proto/terminal.html" title="Struct template terminal">proto::terminal</a><span class="special"><</span><span class="keyword">int</span><span class="special">></span><span class="special">::</span><span class="identifier">type</span> <span class="special">></span> <span class="keyword">const</span> <span class="identifier">_1</span> <span class="special">=</span> <span class="special">{</span><span class="special">{</span><span class="number">1</span><span class="special">}</span><span class="special">}</span><span class="special">;</span></pre>
85 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
86 <li class="listitem"><code class="computeroutput"><a class="link" href="BOOST_PROTO_EXTENDS_ASSIGN.html" title="Macro BOOST_PROTO_EXTENDS_ASSIGN">BOOST_PROTO_EXTENDS_ASSIGN</a>()</code></li>
87 <li class="listitem"><code class="computeroutput"><a class="link" href="BOOST_PROTO_EXTENDS_SUBSCRIPT.html" title="Macro BOOST_PROTO_EXTENDS_SUBSCRIPT">BOOST_PROTO_EXTENDS_SUBSCRIPT</a>()</code></li>
88 <li class="listitem"><code class="computeroutput"><a class="link" href="BOOST_PROTO_EXTENDS_FUNCTION.html" title="Macro BOOST_PROTO_EXTENDS_FUNCTION">BOOST_PROTO_EXTENDS_FUNCTION</a>()</code></li>
89 <li class="listitem"><code class="computeroutput"><a class="link" href="BOOST_PROTO_EXTENDS.html" title="Macro BOOST_PROTO_EXTENDS">BOOST_PROTO_EXTENDS</a>()</code></li>
95 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
96 <td align="left"></td>
97 <td align="right"><div class="copyright-footer">Copyright © 2008 Eric Niebler<p>
98 Distributed under the Boost Software License, Version 1.0. (See accompanying
99 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>)
104 <div class="spirit-nav">
105 <a accesskey="p" href="BOOST_PROTO_EXTENDS.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="proto/reference.html#header.boost.proto.extends_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="BOOST_PROTO_EXTENDS_ASSIGN.html"><img src="../../doc/src/images/next.png" alt="Next"></a>