]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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.7: http://docutils.sourceforge.net/" /> | |
7 | <title>The MPL Reference Manual: value_type</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="./size.html" class="navigation-link">Prev</a> <a href="./iterators.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./size.html" class="navigation-link">Back</a> Along</span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./intrinsic-metafunctions.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="./sequences.html" class="navigation-link">Sequences</a> / <a href="./intrinsic-metafunctions.html" class="navigation-link">Intrinsic Metafunctions</a> / <a href="./value-type.html" class="navigation-link">value_type</a></td> | |
13 | </tr></table><div class="header-separator"></div> | |
14 | <div class="section" id="value-type"> | |
15 | <h1><a class="toc-backref" href="./intrinsic-metafunctions.html#id1447">value_type</a></h1> | |
16 | <div class="section" id="id371"> | |
17 | <h3><a class="subsection-title" href="#synopsis" name="synopsis">Synopsis</a></h3> | |
18 | <pre class="literal-block"> | |
19 | template< | |
20 | typename Sequence | |
21 | , typename X | |
22 | > | |
23 | struct <a href="./value-type.html" class="identifier">value_type</a> | |
24 | { | |
25 | typedef <em>unspecified</em> type; | |
26 | }; | |
27 | </pre> | |
28 | </div> | |
29 | <div class="section" id="id372"> | |
30 | <h3><a class="subsection-title" href="#description" name="description">Description</a></h3> | |
31 | <p>Returns the <a class="reference internal" href="./associative-sequence.html#value-part">value</a> that would be used for element <tt class="literal"><span class="pre">X</span></tt> in <tt class="literal"><span class="pre">Sequence</span></tt>.</p> | |
32 | </div> | |
33 | <div class="section" id="id373"> | |
34 | <h3><a class="subsection-title" href="#header" name="header">Header</a></h3> | |
35 | <pre class="literal-block"> | |
36 | #include <<a href="../../../../boost/mpl/value_type.hpp" class="header">boost/mpl/value_type.hpp</a>> | |
37 | </pre> | |
38 | </div> | |
39 | <div class="section" id="id374"> | |
40 | <h3><a class="subsection-title" href="#model-of" name="model-of">Model of</a></h3> | |
41 | <p><a class="reference internal" href="./tag-dispatched-metafunction.html">Tag Dispatched Metafunction</a></p> | |
42 | </div> | |
43 | <div class="section" id="id375"> | |
44 | <h3><a class="subsection-title" href="#parameters" name="parameters">Parameters</a></h3> | |
45 | <table border="1" class="docutils table"> | |
46 | <colgroup> | |
47 | <col width="17%" /> | |
48 | <col width="30%" /> | |
49 | <col width="53%" /> | |
50 | </colgroup> | |
51 | <thead valign="bottom"> | |
52 | <tr><th class="head">Parameter</th> | |
53 | <th class="head">Requirement</th> | |
54 | <th class="head">Description</th> | |
55 | </tr> | |
56 | </thead> | |
57 | <tbody valign="top"> | |
58 | <tr><td><tt class="literal"><span class="pre">Sequence</span></tt></td> | |
59 | <td><a class="reference internal" href="./associative-sequence.html">Associative Sequence</a></td> | |
60 | <td>A sequence to query.</td> | |
61 | </tr> | |
62 | <tr><td><tt class="literal"><span class="pre">X</span></tt></td> | |
63 | <td>Any type</td> | |
64 | <td>The type to get the <a class="reference internal" href="./associative-sequence.html#value-part">value</a> for.</td> | |
65 | </tr> | |
66 | </tbody> | |
67 | </table> | |
68 | </div> | |
69 | <div class="section" id="id376"> | |
70 | <h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3> | |
71 | <p>For any <a class="reference internal" href="./associative-sequence.html">Associative Sequence</a> <tt class="literal"><span class="pre">s</span></tt>, and an artibrary type <tt class="literal"><span class="pre">x</span></tt>:</p> | |
72 | <pre class="literal-block"> | |
73 | typedef <a href="./value-type.html" class="identifier">value_type</a><s,x>::type v; | |
74 | </pre> | |
75 | <table class="docutils field-list" frame="void" rules="none"> | |
76 | <col class="field-name" /> | |
77 | <col class="field-body" /> | |
78 | <tbody valign="top"> | |
79 | <tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">A type.</p> | |
80 | </td> | |
81 | </tr> | |
82 | <tr class="field"><th class="field-name">Precondition:</th><td class="field-body"><p class="first"><tt class="literal"><span class="pre">x</span></tt> can be put in <tt class="literal"><span class="pre">s</span></tt>.</p> | |
83 | </td> | |
84 | </tr> | |
85 | <tr class="field"><th class="field-name">Semantics:</th><td class="field-body"><p class="first"><tt class="literal"><span class="pre">v</span></tt> is the <a class="reference internal" href="./associative-sequence.html#value-part">value</a> that would be used for <tt class="literal"><span class="pre">x</span></tt> in <tt class="literal"><span class="pre">s</span></tt>.</p> | |
86 | </td> | |
87 | </tr> | |
88 | <tr class="field"><th class="field-name">Postcondition:</th><td class="field-body"><p class="first">If | |
89 | .. parsed-literal:</p> | |
90 | <pre class="literal-block"> | |
91 | <a href="./has-key.html" class="identifier">has_key</a>< s,<a href="./key-type.html" class="identifier">key_type</a><s,x>::type >::type | |
92 | </pre> | |
93 | <p>then | |
94 | .. parsed-literal:</p> | |
95 | <pre class="literal-block"> | |
96 | <a href="./at.html" class="identifier">at</a>< s,<a href="./key-type.html" class="identifier">key_type</a><s,x>::type >::type | |
97 | </pre> | |
98 | <p class="last">is identical to <tt class="literal"><span class="pre"><a href="./value-type.html" class="identifier">value_type</a><s,x>::type</span></tt>.</p> | |
99 | </td> | |
100 | </tr> | |
101 | </tbody> | |
102 | </table> | |
103 | </div> | |
104 | <div class="section" id="id377"> | |
105 | <h3><a class="subsection-title" href="#complexity" name="complexity">Complexity</a></h3> | |
106 | <p>Amortized constant time.</p> | |
107 | </div> | |
108 | <div class="section" id="id378"> | |
109 | <h3><a class="subsection-title" href="#example" name="example">Example</a></h3> | |
110 | <pre class="literal-block"> | |
111 | typedef <a href="./value-type.html" class="identifier">value_type</a>< <a href="./map.html" class="identifier">map</a><>,<a href="./pair.html" class="identifier">pair</a><int,unsigned> >::type v1; | |
112 | typedef <a href="./value-type.html" class="identifier">value_type</a>< <a href="./set.html" class="identifier">set</a><>,<a href="./pair.html" class="identifier">pair</a><int,unsigned> >::type v2; | |
113 | ||
114 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< v1,unsigned > )); | |
115 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< v2,<a href="./pair.html" class="identifier">pair</a><int,unsigned> > )); | |
116 | </pre> | |
117 | </div> | |
118 | <div class="section" id="id379"> | |
119 | <h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3> | |
120 | <p><a class="reference internal" href="./associative-sequence.html">Associative Sequence</a>, <a class="reference internal" href="./key-type.html">key_type</a>, <a class="reference internal" href="./at.html">at</a>, <a class="reference internal" href="./set.html">set</a>, <a class="reference internal" href="./map.html">map</a></p> | |
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="./size.html" class="navigation-link">Prev</a> <a href="./iterators.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./size.html" class="navigation-link">Back</a> Along</span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./intrinsic-metafunctions.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 | <td><div class="copyright-footer"><div class="copyright">Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams</div> | |
127 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
128 | file LICENSE_1_0.txt or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</div></td></tr></table></body> | |
129 | </html> |