Sophie

Sophie

distrib > Mageia > 6 > armv5tl > by-pkgid > 37eb773c4f50677290a7937043b43933 > files > 1623

boost-devel-doc-1.60.0-6.1.mga6.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Struct template domain</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<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_cop_idm45506996666736.html" title="Function template deep_copy">
<link rel="next" href="domain/as_expr.html" title="Struct template as_expr">
</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_cop_idm45506996666736.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.domain_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="domain/as_expr.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<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>,
          <code class="computeroutput"><a class="link" href="../../BOOST_PROTO_EXTENDS.html" title="Macro BOOST_PROTO_EXTENDS">BOOST_PROTO_EXTENDS</a>()</code> and
          <code class="computeroutput"><a class="link" href="../../BOOST_PROTO_DEFINE_OPERATORS.html" title="Macro BOOST_PROTO_DEFINE_OPERATORS">BOOST_PROTO_DEFINE_OPERATORS</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>. It may also have a super-domain. Expressions
          in a sub-domain are interoperable (i.e. can be combined freely with) expressions in a
          super-domain. Finally, domains control how non-Proto objects are turned into Proto
          expressions and how they are combined to form larger Proto expressions.
        </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="comment">// 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;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Generator <span class="special">=</span> <a class="link" href="default_generator.html" title="Struct default_generator">proto::default_generator</a><span class="special">,</span> 
         <span class="keyword">typename</span> Grammar <span class="special">=</span> <a class="link" href="_.html" title="Struct _">proto::_</a><span class="special">,</span> <span class="keyword">typename</span> Super <span class="special">=</span> <em class="replaceable"><code><span class="identifier">unspecified</span></code></em><span class="special">&gt;</span> 
<span class="keyword">struct</span> <a class="link" href="domain.html" title="Struct template domain">domain</a> <span class="special">:</span> <span class="keyword"></span> Generator <span class="special">{</span>
  <span class="comment">// types</span>
  <span class="keyword">typedef</span> <span class="identifier">Grammar</span>   <a name="boost.proto.domain.proto_grammar"></a><span class="identifier">proto_grammar</span><span class="special">;</span>     
  <span class="keyword">typedef</span> <span class="identifier">Generator</span> <a name="boost.proto.domain.proto_generator"></a><span class="identifier">proto_generator</span><span class="special">;</span>   
  <span class="keyword">typedef</span> <span class="identifier">Super</span>     <a name="boost.proto.domain.proto_super_domain"></a><span class="identifier">proto_super_domain</span><span class="special">;</span>

  <span class="comment">// member classes/structs/unions</span>

  <span class="comment">// A callable unary MonomorphicFunctionObject that specifies how objects are
  // turned into Proto expressions in this domain. The resulting expression
  // object is suitable for storage in a local variable.</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="keyword">struct</span> <a class="link" href="domain/as_expr.html" title="Struct template as_expr">as_expr</a> <span class="special">:</span> <span class="keyword"></span> <a class="link" href="callable.html" title="Struct callable">proto::callable</a> <span class="special">{</span>
    <span class="comment">// types</span>
    <span class="keyword">typedef</span> <em class="replaceable"><code><span class="identifier">see</span><span class="special">-</span><span class="identifier">below</span></code></em> <a class="link" href="domain/as_expr.html#boost.proto.domain.as_expr.result_type"><span class="identifier">result_type</span></a><span class="special">;</span>

    <span class="comment">// <a class="link" href="domain/as_expr.html#idm45506996611248-bb">public member functions</a></span>
    <span class="identifier">result_type</span> <a class="link" href="domain/as_expr.html#idm45506996610688-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="identifier">T</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="special">}</span><span class="special">;</span>

  <span class="comment">// A callable unary MonomorphicFunctionObject that specifies how objects are
  // turned into Proto expressions in this domain, for use in scenarios where
  // the resulting expression is intended to be made a child of another
  // expression.</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="keyword">struct</span> <a class="link" href="domain/as_child.html" title="Struct template as_child">as_child</a> <span class="special">:</span> <span class="keyword"></span> <a class="link" href="callable.html" title="Struct callable">proto::callable</a> <span class="special">{</span>
    <span class="comment">// types</span>
    <span class="keyword">typedef</span> <em class="replaceable"><code><span class="identifier">see</span><span class="special">-</span><span class="identifier">below</span></code></em> <a class="link" href="domain/as_child.html#boost.proto.domain.as_child.result_type"><span class="identifier">result_type</span></a><span class="special">;</span>

    <span class="comment">// <a class="link" href="domain/as_child.html#idm45506996592432-bb">public member functions</a></span>
    <span class="identifier">result_type</span> <a class="link" href="domain/as_child.html#idm45506996591872-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="identifier">T</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="special">}</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idm45555192352416"></a><h2>Description</h2>
<p>
            The Generator parameter determines how new expressions in the domain are post-processed. 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 parameter 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>
            The Super parameter declares the domain currently being defined to be a sub-domain of Super. An expression in
            a sub-domain can be freely combined with expressions in its super-domain (and <span class="emphasis"><em>its</em></span>
            super-domain, etc.).
          </p>
<p>
            Example: </p>
<pre class="programlisting"> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Expr</span><span class="special">&gt;</span>
 <span class="keyword">struct</span> <span class="identifier">MyExpr</span><span class="special">;</span>

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

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

 <span class="comment">// Use MyDomain to define MyExpr</span>
 <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Expr</span><span class="special">&gt;</span>
 <span class="keyword">struct</span> <span class="identifier">MyExpr</span>
   <span class="special">:</span> <a class="link" href="extends.html" title="Struct template extends">proto::extends</a><span class="special">&lt;</span><span class="identifier">Expr</span><span class="special">,</span> <span class="identifier">MyExpr</span><span class="special">&lt;</span><span class="identifier">Expr</span><span class="special">&gt;</span><span class="special">,</span> <span class="identifier">MyDomain</span><span class="special">&gt;</span>
 <span class="special">{</span>
     <span class="comment">// ...</span>
 <span class="special">}</span><span class="special">;</span>
            </pre>
<p>
          </p>
<p>
            The <code class="computeroutput"><a class="link" href="domain/as_expr.html" title="Struct template as_expr">domain::as_expr</a>&lt;&gt;</code> and
            <code class="computeroutput"><a class="link" href="domain/as_child.html" title="Struct template as_child">domain::as_child</a>&lt;&gt;</code> member
            templates define how non-Proto objects are turned into Proto terminals and how Proto
            expressions should be processed before they are combined to form larger expressions. 
            They can be overridden in a derived domain for customization. See their descriptions to
            understand how Proto uses these two templates and what their default behavior is.
          </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_cop_idm45506996666736.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.domain_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="domain/as_expr.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>