| 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> <a href="./arithmetic-operations.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./arg.html" class="navigation-link">Back</a> Along</span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./composition-and-argument.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </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"> |
|---|
| 19 | template< |
|---|
| 20 | typename F |
|---|
| 21 | > |
|---|
| 22 | struct <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 |
|---|
| 32 | its 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 <<a href="../../../../boost/mpl/protect.hpp" class="header">boost/mpl/protect.hpp</a>> |
|---|
| 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"> |
|---|
| 66 | typedef <a href="./protect.html" class="identifier">protect</a><f> 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"> |
|---|
| 76 | struct g |
|---|
| 77 | { |
|---|
| 78 | template< |
|---|
| 79 | typename U1 = <em>unspecified</em>,<em>...</em> typename U<em>n</em> = <em>unspecified</em> |
|---|
| 80 | > |
|---|
| 81 | struct <a href="./apply.html" class="identifier">apply</a> |
|---|
| 82 | : <a href="./apply-wrap.html" class="identifier">apply_wrap</a><em>n</em><f,U1,<em>...</em>U<em>n</em>> |
|---|
| 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"> |
|---|
| 96 | FIXME |
|---|
| 97 | |
|---|
| 98 | struct f |
|---|
| 99 | { |
|---|
| 100 | template< typename T1, typename T2 > struct <a href="./apply.html" class="identifier">apply</a> |
|---|
| 101 | { |
|---|
| 102 | // <em>...</em> |
|---|
| 103 | }; |
|---|
| 104 | }; |
|---|
| 105 | |
|---|
| 106 | typedef <a href="./bind.html" class="identifier">bind</a><_1, <a href="./protect.html" class="identifier">protect</a>< <a href="./bind.html" class="identifier">bind</a><f,_1,_2> > > |
|---|
| 107 | |
|---|
| 108 | typedef apply_wrap0< f0 >::type r1; |
|---|
| 109 | typedef apply_wrap0< g0 >::type r2; |
|---|
| 110 | typedef apply_wrap2< f2,int,char >::type r3; |
|---|
| 111 | |
|---|
| 112 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same<r1,char> )); |
|---|
| 113 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same<r2,char> )); |
|---|
| 114 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same<r3,char> )); |
|---|
| 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> <a href="./arithmetic-operations.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./arg.html" class="navigation-link">Back</a> Along</span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./composition-and-argument.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td> |
|---|
| 126 | </tr></table></body> |
|---|
| 127 | </html> |
|---|