Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > fa7fad8f194f80107561a85291acd153 > files > 1668

lib64boost-devel-doc-1.42.0-3mdv2010.1.x86_64.rpm

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Struct template domain</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../proto/reference.html#header.boost.proto.domain_hpp" title="Header &lt;boost/proto/domain.hpp&gt;">
<link rel="prev" href="deep_copy_id1235315.html" title="Function template deep_copy">
<link rel="next" href="default_domain.html" title="Struct default_domain">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="deep_copy_id1235315.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.domain_hpp"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="default_domain.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a>
</div>
<div class="refentry" title="Struct template domain">
<a name="boost.proto.domain"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Struct template domain</span></h2>
<p>boost::proto::domain &#8212; For use in defining domain tags to be used with <code class="computeroutput">
          <a class="link" href="extends.html" title="Struct template extends">proto::extends&lt;&gt;</a></code>. A
          <span class="emphasis"><em>domain</em></span> associates an expression type with a <span class="emphasis"><em>generator</em></span>,
          and optionally a <span class="emphasis"><em>grammar</em></span>.
        </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="emphasis"><em>// In header: &lt;<a class="link" href="../../proto/reference.html#header.boost.proto.domain_hpp" title="Header &lt;boost/proto/domain.hpp&gt;">boost/proto/domain.hpp</a>&gt;

</em></span><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> Generator = <a class="link" href="default_generator.html" title="Struct default_generator">proto::default_generator</a>, 
         <span class="bold"><strong>typename</strong></span> Grammar = <a class="link" href="_.html" title="Struct _">proto::_</a>&gt; 
<span class="bold"><strong>struct</strong></span> <a class="link" href="domain.html" title="Struct template domain">domain</a> : <span class="bold"><strong></strong></span> <span class="type">Generator</span> {
  <span class="emphasis"><em>// types</em></span>
  <span class="bold"><strong>typedef</strong></span> Grammar <a name="boost.proto.domain.proto_grammar"></a>proto_grammar;
};</pre></div>
<div class="refsect1" title="Description">
<a name="id1581736"></a><h2>Description</h2>
<p>
            The Generator determines how new expressions in the domain are constructed. Typically, a generator
            wraps all new expressions in a wrapper that imparts domain-specific behaviors to expressions within
            its domain. (See <code class="computeroutput"><a class="link" href="extends.html" title="Struct template extends">proto::extends&lt;&gt;</a></code>.)
          </p>
<p>
            The Grammar determines whether a given expression is valid within the domain, and automatically
            disables any operator overloads which would cause an invalid expression to be created. By default,
            the Grammar parameter defaults to the wildcard, <code class="computeroutput"><a class="link" href="_.html" title="Struct _">proto::_</a>
            </code>, which makes all expressions valid within the domain.
          </p>
<p>
            Example: </p>
<pre class="programlisting"> template&lt;typename Expr&gt;
 struct MyExpr;

 struct MyGrammar
   : <a class="link" href="or_.html" title="Struct template or_">proto::or_</a>&lt; <a class="link" href="terminal.html" title="Struct template terminal">proto::terminal</a>&lt;_&gt;, <a class="link" href="plus.html" title="Struct template plus">proto::plus</a>&lt;MyGrammar, MyGrammar&gt; &gt;
 {};

 // Define MyDomain, in which all expressions are
 // wrapped in MyExpr&lt;&gt; and only expressions that
 // conform to MyGrammar are allowed.
 struct MyDomain
   : <a class="link" href="domain.html" title="Struct template domain">proto::domain</a>&lt;<a class="link" href="generator.html" title="Struct template generator">proto::generator</a>&lt;MyExpr&gt;, MyGrammar&gt;
 {};

 // Use MyDomain to define MyExpr
 template&lt;typename Expr&gt;
 struct MyExpr
   : <a class="link" href="extends.html" title="Struct template extends">proto::extends</a>&lt;Expr, MyExpr&lt;Expr&gt;, MyDomain&gt;
 {
     // ...
 };
            </pre>
<p>
          </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2008 Eric Niebler<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        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>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="deep_copy_id1235315.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.domain_hpp"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="default_domain.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>