| 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 | <!-- Copyright Aleksey Gurtovoy 2006. Distributed under the Boost --> |
|---|
| 5 | <!-- Software License, Version 1.0. (See accompanying --> |
|---|
| 6 | <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) --> |
|---|
| 7 | <head> |
|---|
| 8 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|---|
| 9 | <meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" /> |
|---|
| 10 | <title>The MPL Reference Manual: arg</title> |
|---|
| 11 | <link rel="stylesheet" href="../style.css" type="text/css" /> |
|---|
| 12 | </head> |
|---|
| 13 | <body class="docframe refmanual"> |
|---|
| 14 | <table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./quote.html" class="navigation-link">Prev</a> <a href="./protect.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./quote.html" class="navigation-link">Back</a> <a href="./protect.html" class="navigation-link">Along</a></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> |
|---|
| 15 | <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="./arg.html" class="navigation-link">arg</a></td> |
|---|
| 16 | </tr></table><div class="header-separator"></div> |
|---|
| 17 | <div class="section" id="arg"> |
|---|
| 18 | <h1><a class="toc-backref" href="./composition-and-argument.html#id459" name="arg">arg</a></h1> |
|---|
| 19 | <div class="section" id="arg-synopsis"> |
|---|
| 20 | <h3><a class="subsection-title" href="#synopsis" name="synopsis">Synopsis</a></h3> |
|---|
| 21 | <pre class="literal-block"> |
|---|
| 22 | template< int n > struct <a href="./arg.html" class="identifier">arg</a>; |
|---|
| 23 | |
|---|
| 24 | template<> struct <a href="./arg.html" class="identifier">arg</a><1> |
|---|
| 25 | { |
|---|
| 26 | template< typename A1,<em>...</em> typename A<em>n</em> = <em>unspecified</em> > |
|---|
| 27 | struct <a href="./apply.html" class="identifier">apply</a> |
|---|
| 28 | { |
|---|
| 29 | typedef A1 type; |
|---|
| 30 | }; |
|---|
| 31 | }; |
|---|
| 32 | |
|---|
| 33 | <em>...</em> |
|---|
| 34 | |
|---|
| 35 | template<> struct <a href="./arg.html" class="identifier">arg</a><<em>n</em>> |
|---|
| 36 | { |
|---|
| 37 | template< typename A1,<em>...</em> typename A<em>n</em> > |
|---|
| 38 | struct <a href="./apply.html" class="identifier">apply</a> |
|---|
| 39 | { |
|---|
| 40 | typedef A<em>n</em> type; |
|---|
| 41 | }; |
|---|
| 42 | }; |
|---|
| 43 | </pre> |
|---|
| 44 | </div> |
|---|
| 45 | <div class="section" id="arg-description"> |
|---|
| 46 | <h3><a class="subsection-title" href="#description" name="description">Description</a></h3> |
|---|
| 47 | <p><tt class="literal"><span class="pre"><a href="./arg.html" class="identifier">arg</a><n></span></tt> specialization is a <a class="reference" href="./metafunction-class.html">Metafunction Class</a> that return the <tt class="literal"><span class="pre">n</span></tt>th of its arguments.</p> |
|---|
| 48 | </div> |
|---|
| 49 | <div class="section" id="arg-header"> |
|---|
| 50 | <h3><a class="subsection-title" href="#header" name="header">Header</a></h3> |
|---|
| 51 | <pre class="literal-block"> |
|---|
| 52 | #include <<a href="../../../../boost/mpl/arg.hpp" class="header">boost/mpl/arg.hpp</a>> |
|---|
| 53 | </pre> |
|---|
| 54 | </div> |
|---|
| 55 | <div class="section" id="arg-parameters"> |
|---|
| 56 | <h3><a class="subsection-title" href="#parameters" name="parameters">Parameters</a></h3> |
|---|
| 57 | <table border="1" class="table"> |
|---|
| 58 | <colgroup> |
|---|
| 59 | <col width="15%" /> |
|---|
| 60 | <col width="36%" /> |
|---|
| 61 | <col width="48%" /> |
|---|
| 62 | </colgroup> |
|---|
| 63 | <thead valign="bottom"> |
|---|
| 64 | <tr><th>Parameter</th> |
|---|
| 65 | <th>Requirement</th> |
|---|
| 66 | <th>Description</th> |
|---|
| 67 | </tr> |
|---|
| 68 | </thead> |
|---|
| 69 | <tbody valign="top"> |
|---|
| 70 | <tr><td><tt class="literal"><span class="pre">n</span></tt></td> |
|---|
| 71 | <td>An integral constant</td> |
|---|
| 72 | <td>A number of argument to return.</td> |
|---|
| 73 | </tr> |
|---|
| 74 | </tbody> |
|---|
| 75 | </table> |
|---|
| 76 | </div> |
|---|
| 77 | <div class="section" id="arg-expression-semantics"> |
|---|
| 78 | <h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3> |
|---|
| 79 | <p>For any integral constant <tt class="literal"><span class="pre">n</span></tt> in the range [1, <a class="refentry reference" href="./limit-metafunction-arity.html"><tt class="refentry literal"><span class="pre">BOOST_MPL_LIMIT_METAFUNCTION_ARITY</span></tt></a>] and |
|---|
| 80 | arbitrary types <tt class="literal"><span class="pre">a1</span></tt>,... <tt class="literal"><span class="pre">an</span></tt>:</p> |
|---|
| 81 | <pre class="literal-block"> |
|---|
| 82 | typedef <a href="./apply-wrap.html" class="identifier">apply_wrap</a><em>n</em>< <a href="./arg.html" class="identifier">arg</a><<em>n</em>>,a1,<em>...</em>a<em>n</em> >::type x; |
|---|
| 83 | </pre> |
|---|
| 84 | <table class="field-list" frame="void" rules="none"> |
|---|
| 85 | <col class="field-name" /> |
|---|
| 86 | <col class="field-body" /> |
|---|
| 87 | <tbody valign="top"> |
|---|
| 88 | <tr class="field"><th class="field-name">Return type:</th><td class="field-body">A type.</td> |
|---|
| 89 | </tr> |
|---|
| 90 | <tr class="field"><th class="field-name">Semantics:</th><td class="field-body"><tt class="literal"><span class="pre">x</span></tt> is identical to <tt class="literal"><span class="pre">an</span></tt>.</td> |
|---|
| 91 | </tr> |
|---|
| 92 | </tbody> |
|---|
| 93 | </table> |
|---|
| 94 | </div> |
|---|
| 95 | <div class="section" id="arg-example"> |
|---|
| 96 | <h3><a class="subsection-title" href="#example" name="example">Example</a></h3> |
|---|
| 97 | <pre class="literal-block"> |
|---|
| 98 | typedef <a href="./apply-wrap.html" class="identifier">apply_wrap</a><tt class="literal"><span class="pre">5</span></tt>< <a href="./arg.html" class="identifier">arg</a><1>,bool,char,short,int,long >::type t1; |
|---|
| 99 | typedef <a href="./apply-wrap.html" class="identifier">apply_wrap</a><tt class="literal"><span class="pre">5</span></tt>< <a href="./arg.html" class="identifier">arg</a><3>,bool,char,short,int,long >::type t3; |
|---|
| 100 | |
|---|
| 101 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< t1, bool > )); |
|---|
| 102 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< t3, short > )); |
|---|
| 103 | </pre> |
|---|
| 104 | </div> |
|---|
| 105 | <div class="section" id="arg-see-also"> |
|---|
| 106 | <h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3> |
|---|
| 107 | <p><a class="reference" href="./composition-and-argument.html">Composition and Argument Binding</a>, <a class="reference" href="./placeholders.html">Placeholders</a>, <a class="refentry reference" href="./lambda.html"><tt class="refentry literal"><span class="pre">lambda</span></tt></a>, <a class="refentry reference" href="./bind.html"><tt class="refentry literal"><span class="pre">bind</span></tt></a>, <a class="refentry reference" href="./apply.html"><tt class="refentry literal"><span class="pre">apply</span></tt></a>, <a class="refentry reference" href="./apply-wrap.html"><tt class="refentry literal"><span class="pre">apply_wrap</span></tt></a></p> |
|---|
| 108 | <!-- modtime: November 13, 2004 18:35:04 +0000 --> |
|---|
| 109 | <!-- Metafunctions/Composition and Argument Binding//protect |60 --> |
|---|
| 110 | </div> |
|---|
| 111 | </div> |
|---|
| 112 | |
|---|
| 113 | <div class="footer-separator"></div> |
|---|
| 114 | <table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./quote.html" class="navigation-link">Prev</a> <a href="./protect.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./quote.html" class="navigation-link">Back</a> <a href="./protect.html" class="navigation-link">Along</a></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> |
|---|
| 115 | </tr></table></body> |
|---|
| 116 | </html> |
|---|