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>Macro BOOST_PROTO_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/result.html" title="Struct template result"> 11<link rel="next" href="BOOST_PROTO_BASIC_EXTENDS.html" title="Macro BOOST_PROTO_BASIC_EXTENDS"> 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="boost/proto/extends/result.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_BASIC_EXTENDS.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 25</div> 26<div class="refentry"> 27<a name="BOOST_PROTO_EXTENDS"></a><div class="titlepage"></div> 28<div class="refnamediv"> 29<h2><span class="refentrytitle">Macro BOOST_PROTO_EXTENDS</span></h2> 30<p>BOOST_PROTO_EXTENDS — For creating expression wrappers that add behaviors 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> 33</div> 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>> 36 37</span>BOOST_PROTO_EXTENDS(Expr, Derived, Domain)</pre></div> 38<div class="refsect1"> 39<a name="id-1.3.33.5.12.7.4"></a><h2>Description</h2> 40<p> 41 Equivalent to: 42 </p> 43<pre class="programlisting"><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">Derived</span><span class="special">,</span> <span class="identifier">Domain</span><span class="special">)</span> 44<a class="link" href="BOOST_PROTO_EXTENDS_ASSIGN.html" title="Macro BOOST_PROTO_EXTENDS_ASSIGN">BOOST_PROTO_EXTENDS_ASSIGN</a><span class="special">(</span><span class="special">)</span> 45<a class="link" href="BOOST_PROTO__1_3_33_5_10_7.html" title="Macro BOOST_PROTO_EXTENDS_SUBSCRIPT">BOOST_PROTO_EXTENDS_SUBSCRIPT</a><span class="special">(</span><span class="special">)</span> 46<a class="link" href="BOOST_PROTO__1_3_33_5_10_6.html" title="Macro BOOST_PROTO_EXTENDS_FUNCTION">BOOST_PROTO_EXTENDS_FUNCTION</a><span class="special">(</span><span class="special">)</span></pre> 47<p> 48 </p> 49<p>If the <code class="computeroutput">Domain</code> parameter is dependent, you can specify it as 50 <code class="computeroutput">typename Domain</code>, as in 51 <code class="computeroutput">BOOST_PROTO_EXTENDS(Expr, Derived, typename Domain)</code> 52 </p> 53<p> 54 <span class="bold"><strong>Example:</strong></span></p> 55<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> 56<span class="keyword">struct</span> <span class="identifier">my_expr</span><span class="special">;</span> 57 58<span class="keyword">struct</span> <span class="identifier">my_domain</span> 59 <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> 60<span class="special">{</span><span class="special">}</span><span class="special">;</span> 61 62<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> 64<span class="special">{</span> 65 <span class="comment">// OK, this makes my_expr<> a valid Proto expression extension.</span> 66 <span class="comment">// my_expr<> has overloaded assignment, subscript,</span> 67 <span class="comment">// and function call operators that build expression templates.</span> 68 <a class="link" href="BOOST_PROTO_EXTENDS.html" title="Macro BOOST_PROTO_EXTENDS">BOOST_PROTO_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> 69<span class="special">}</span><span class="special">;</span> 70 71<span class="comment">// OK, my_expr<> is POD, so this is statically initialized:</span> 72<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> 73<p> 74 </p> 75</div> 76</div> 77<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 78<td align="left"></td> 79<td align="right"><div class="copyright-footer">Copyright © 2008 Eric Niebler<p> 80 Distributed under the Boost Software License, Version 1.0. (See accompanying 81 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>) 82 </p> 83</div></td> 84</tr></table> 85<hr> 86<div class="spirit-nav"> 87<a accesskey="p" href="boost/proto/extends/result.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_BASIC_EXTENDS.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 88</div> 89</body> 90</html> 91