Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/mpl/doc/refmanual/protect.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 7.5 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" />
7<title>The MPL Reference Manual: protect</title>
8<link rel="stylesheet" href="../style.css" type="text/css" />
9</head>
10<body class="docframe refmanual">
11<table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./arg.html" class="navigation-link">Prev</a>&nbsp;<a href="./arithmetic-operations.html" class="navigation-link">Next</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./arg.html" class="navigation-link">Back</a>&nbsp;Along</span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./composition-and-argument.html" class="navigation-link">Up</a>&nbsp;<a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
12<td class="header-group page-location"><a href="../refmanual.html" class="navigation-link">Front Page</a> / <a href="./metafunctions.html" class="navigation-link">Metafunctions</a> / <a href="./composition-and-argument.html" class="navigation-link">Composition and Argument Binding</a> / <a href="./protect.html" class="navigation-link">protect</a></td>
13</tr></table><div class="header-separator"></div>
14<div class="section" id="protect">
15<h1><a class="toc-backref" href="./composition-and-argument.html#id460" name="protect">protect</a></h1>
16<div class="section" id="protect-synopsis">
17<h3><a class="subsection-title" href="#synopsis" name="synopsis">Synopsis</a></h3>
18<pre class="literal-block">
19template&lt; 
20      typename F
21    &gt;
22struct <a href="./protect.html" class="identifier">protect</a>
23{
24    // <em>unspecified</em>
25    // <em>...</em>
26};
27</pre>
28</div>
29<div class="section" id="protect-description">
30<h3><a class="subsection-title" href="#description" name="description">Description</a></h3>
31<p><tt class="literal"><span class="pre"><a href="./protect.html" class="identifier">protect</a></span></tt> is an identity wrapper for a <a class="reference" href="./metafunction-class.html">Metafunction Class</a> that prevents
32its argument from being recognized as a <a class="reference" href="./terminology.html#bind-expression">bind expression</a>.</p>
33</div>
34<div class="section" id="protect-header">
35<h3><a class="subsection-title" href="#header" name="header">Header</a></h3>
36<pre class="literal-block">
37#include &lt;<a href="../../../../boost/mpl/protect.hpp" class="header">boost/mpl/protect.hpp</a>&gt;
38</pre>
39</div>
40<div class="section" id="protect-parameters">
41<h3><a class="subsection-title" href="#parameters" name="parameters">Parameters</a></h3>
42<table border="1" class="table">
43<colgroup>
44<col width="19%" />
45<col width="33%" />
46<col width="48%" />
47</colgroup>
48<thead valign="bottom">
49<tr><th>Parameter</th>
50<th>Requirement</th>
51<th>Description</th>
52</tr>
53</thead>
54<tbody valign="top">
55<tr><td><tt class="literal"><span class="pre">F</span></tt></td>
56<td><a class="reference" href="./metafunction-class.html">Metafunction Class</a></td>
57<td>A metafunction class to wrap.</td>
58</tr>
59</tbody>
60</table>
61</div>
62<div class="section" id="protect-expression-semantics">
63<h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3>
64<p>For any <a class="reference" href="./metafunction-class.html">Metafunction Class</a> <tt class="literal"><span class="pre">f</span></tt>:</p>
65<pre class="literal-block">
66typedef <a href="./protect.html" class="identifier">protect</a>&lt;f&gt; g;
67</pre>
68<table class="field-list" frame="void" rules="none">
69<col class="field-name" />
70<col class="field-body" />
71<tbody valign="top">
72<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference" href="./metafunction-class.html">Metafunction Class</a>.</td>
73</tr>
74<tr class="field"><th class="field-name">Semantics:</th><td class="field-body"><p class="first">If <tt class="literal"><span class="pre">f</span></tt> is a <a class="reference" href="./terminology.html#bind-expression">bind expression</a>, equivalent to</p>
75<pre class="literal-block">
76struct g
77{
78    template&lt; 
79          typename U1 = <em>unspecified</em>,<em>...</em> typename U<em>n</em> = <em>unspecified</em>
80        &gt;
81    struct <a href="./apply.html" class="identifier">apply</a>
82        : <a href="./apply-wrap.html" class="identifier">apply_wrap</a><em>n</em>&lt;f,U1,<em>...</em>U<em>n</em>&gt;
83    {
84    };
85};
86</pre>
87<p class="last">otherwise equivalent to <tt class="literal"><span class="pre">typedef</span> <span class="pre">f</span> <span class="pre">g;</span></tt>.</p>
88</td>
89</tr>
90</tbody>
91</table>
92</div>
93<div class="section" id="protect-example">
94<h3><a class="subsection-title" href="#example" name="example">Example</a></h3>
95<pre class="literal-block">
96FIXME
97
98struct f
99{
100    template&lt; typename T1, typename T2 &gt; struct <a href="./apply.html" class="identifier">apply</a>
101    {
102        // <em>...</em>
103    };
104};
105
106typedef <a href="./bind.html" class="identifier">bind</a>&lt;_1, <a href="./protect.html" class="identifier">protect</a>&lt; <a href="./bind.html" class="identifier">bind</a>&lt;f,_1,_2&gt; &gt; &gt;
107
108typedef apply_wrap0&lt; f0 &gt;::type r1;
109typedef apply_wrap0&lt; g0 &gt;::type r2;
110typedef apply_wrap2&lt; f2,int,char &gt;::type r3;
111
112<a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same&lt;r1,char&gt; ));
113<a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same&lt;r2,char&gt; ));
114<a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same&lt;r3,char&gt; ));
115</pre>
116</div>
117<div class="section" id="protect-see-also">
118<h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3>
119<p><a class="reference" href="./composition-and-argument.html">Composition and Argument Binding</a>, <a class="reference" href="./invocation.html">invocation</a>, <a class="refentry reference" href="./bind.html"><tt class="refentry literal"><span class="pre">bind</span></tt></a>, <a class="refentry reference" href="./quote.html"><tt class="refentry literal"><span class="pre">quote</span></tt></a>, <a class="refentry reference" href="./apply-wrap.html"><tt class="refentry literal"><span class="pre">apply_wrap</span></tt></a></p>
120<!-- modtime: November 10, 2004 04:33:54 +0000 -->
121</div>
122</div>
123
124<div class="footer-separator"></div>
125<table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./arg.html" class="navigation-link">Prev</a>&nbsp;<a href="./arithmetic-operations.html" class="navigation-link">Next</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./arg.html" class="navigation-link">Back</a>&nbsp;Along</span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./composition-and-argument.html" class="navigation-link">Up</a>&nbsp;<a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
126</tr></table></body>
127</html>
Note: See TracBrowser for help on using the repository browser.