• 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 noinvoke</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.transform.make_hpp" title="Header &lt;boost/proto/transform/make.hpp&gt;">
10<link rel="prev" href="lazy/impl.html" title="Struct template impl">
11<link rel="next" href="protect.html" title="Struct template protect">
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="lazy/impl.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.transform.make_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="protect.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="refentry">
27<a name="boost.proto.noinvoke"></a><div class="titlepage"></div>
28<div class="refnamediv">
29<h2><span class="refentrytitle">Struct template noinvoke</span></h2>
30<p>boost::proto::noinvoke — A type annotation in an <a class="link" href="../../ObjectTransform.html" title="Concept ObjectTransform">ObjectTransform</a> which instructs
31          Proto not to look for a nested <code class="computeroutput">::type</code> within
32          <code class="computeroutput">T</code> after type substitution.</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: &lt;<a class="link" href="../../proto/reference.html#header.boost.proto.transform.make_hpp" title="Header &lt;boost/proto/transform/make.hpp&gt;">boost/proto/transform/make.hpp</a>&gt;
36
37</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span>
38<span class="keyword">struct</span> <a class="link" href="noinvoke.html" title="Struct template noinvoke">noinvoke</a> <span class="special">{</span>
39<span class="special">}</span><span class="special">;</span></pre></div>
40<div class="refsect1">
41<a name="id-1.3.33.5.52.4.4"></a><h2>Description</h2>
42<p>
43            <a class="link" href="../../ObjectTransform.html" title="Concept ObjectTransform">ObjectTransform</a>s are evaluated by
44            <code class="computeroutput"><a class="link" href="make.html" title="Struct template make">proto::make&lt;&gt;</a></code>,
45            which finds all nested transforms and replaces them with the result of their applications.
46            If any substitutions are performed, the result is first assumed to be a metafunction to be applied;
47            that is, Proto checks to see if the result has a nested <code class="computeroutput">::type</code>
48            typedef. If it does, that becomes the result. The purpose of <code class="computeroutput">proto::noinvoke&lt;&gt;</code>
49            is to prevent Proto from looking for a nested <code class="computeroutput">::type</code> typedef
50            in these situations.
51          </p>
52<p>
53            Example:
54            </p>
55<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">Test</span>
56  <span class="special">:</span> <a class="link" href="when.html" title="Struct template when">proto::when</a><span class="special">&lt;</span>
57        <a class="link" href="_.html" title="Struct _">_</a>
58      <span class="special">,</span> <span class="identifier">proto</span><span class="special">::</span><span class="identifier">noinvoke</span><span class="special">&lt;</span>
59            <span class="comment">// This remove_pointer invocation is bloked by noinvoke</span>
60            <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_pointer</span><span class="special">&lt;</span>
61                <span class="comment">// This add_pointer invocation is *not* blocked by noinvoke</span>
62                <span class="identifier">boost</span><span class="special">::</span><span class="identifier">add_pointer</span><span class="special">&lt;</span><a class="link" href="_.html" title="Struct _">_</a><span class="special">&gt;</span>
63            <span class="special">&gt;</span>
64        <span class="special">&gt;</span><span class="special">(</span><span class="special">)</span>
65    <span class="special">&gt;</span>
66<span class="special">{</span><span class="special">}</span><span class="special">;</span>
67
68<span class="keyword">void</span> <span class="identifier">test_noinvoke</span><span class="special">(</span><span class="special">)</span>
69<span class="special">{</span>
70    <span class="keyword">typedef</span> <a class="link" href="terminal.html" title="Struct template terminal">proto::terminal</a><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <span class="identifier">Int</span><span class="special">;</span>
71
72    <span class="identifier">BOOST_MPL_ASSERT</span><span class="special">(</span><span class="special">(</span>
73        <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span>
74            <span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">&lt;</span><span class="identifier">Test</span><span class="special">(</span><span class="identifier">Int</span><span class="special">)</span><span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span>
75          <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_pointer</span><span class="special">&lt;</span><span class="identifier">Int</span> <span class="special">*</span><span class="special">&gt;</span>
76        <span class="special">&gt;</span>
77    <span class="special">)</span><span class="special">)</span><span class="special">;</span>
78
79    <span class="identifier">Int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="special">{</span><span class="number">42</span><span class="special">}</span><span class="special">;</span>
80    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_pointer</span><span class="special">&lt;</span><span class="identifier">Int</span> <span class="special">*</span><span class="special">&gt;</span> <span class="identifier">t</span> <span class="special">=</span> <span class="identifier">Test</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">i</span><span class="special">)</span><span class="special">;</span>
81<span class="special">}</span></pre>
82<p>
83          </p>
84</div>
85</div>
86<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
87<td align="left"></td>
88<td align="right"><div class="copyright-footer">Copyright © 2008 Eric Niebler<p>
89        Distributed under the Boost Software License, Version 1.0. (See accompanying
90        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>)
91      </p>
92</div></td>
93</tr></table>
94<hr>
95<div class="spirit-nav">
96<a accesskey="p" href="lazy/impl.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.transform.make_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="protect.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
97</div>
98</body>
99</html>
100