1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>make_map</title> 5<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../../../index.html" title="Chapter 1. Fusion 2.2"> 8<link rel="up" href="../functions.html" title="Functions"> 9<link rel="prev" href="make_set.html" title="make_set"> 10<link rel="next" href="tiers.html" title="Tiers"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="make_set.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../functions.html"><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="tiers.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h5 class="title"> 27<a name="fusion.container.generation.functions.make_map"></a><a class="link" href="make_map.html" title="make_map">make_map</a> 28</h5></div></div></div> 29<h6> 30<a name="fusion.container.generation.functions.make_map.h0"></a> 31 <span class="phrase"><a name="fusion.container.generation.functions.make_map.description"></a></span><a class="link" href="make_map.html#fusion.container.generation.functions.make_map.description">Description</a> 32 </h6> 33<p> 34 Create a <a class="link" href="../../map.html" title="map"><code class="computeroutput"><span class="identifier">map</span></code></a> 35 from one or more key/data pairs. 36 </p> 37<h6> 38<a name="fusion.container.generation.functions.make_map.h1"></a> 39 <span class="phrase"><a name="fusion.container.generation.functions.make_map.synopsis"></a></span><a class="link" href="make_map.html#fusion.container.generation.functions.make_map.synopsis">Synopsis</a> 40 </h6> 41<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span> 42 <span class="keyword">typename</span> <span class="identifier">K0</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">K1</span><span class="special">,...</span> <span class="keyword">typename</span> <span class="identifier">KN</span> 43 <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T0</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,...</span> <span class="keyword">typename</span> <span class="identifier">TN</span><span class="special">></span> 44<span class="keyword">typename</span> <a class="link" href="../metafunctions/make_map.html" title="make_map"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">make_map</span></code></a><span class="special"><</span><span class="identifier">K0</span><span class="special">,</span> <span class="identifier">K0</span><span class="special">,...</span> <span class="identifier">KN</span><span class="special">,</span> <span class="identifier">T0</span><span class="special">,</span> <span class="identifier">T1</span><span class="special">,...</span> <span class="identifier">TN</span><span class="special">>::</span><span class="identifier">type</span> 45<span class="identifier">make_map</span><span class="special">(</span><span class="identifier">T0</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">x0</span><span class="special">,</span> <span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">x1</span><span class="special">...</span> <span class="identifier">TN</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">xN</span><span class="special">);</span> 46</pre> 47<p> 48 For C++11 compilers, the variadic function interface has no upper bound. 49 </p> 50<p> 51 For C++03 compilers, the variadic function accepts <code class="computeroutput"><span class="number">0</span></code> 52 to <code class="computeroutput"><span class="identifier">FUSION_MAX_MAP_SIZE</span></code> 53 elements, where <code class="computeroutput"><span class="identifier">FUSION_MAX_MAP_SIZE</span></code> 54 is a user definable predefined maximum that defaults to <code class="computeroutput"><span class="number">10</span></code>. You may define the preprocessor constant 55 <code class="computeroutput"><span class="identifier">FUSION_MAX_MAP_SIZE</span></code> before 56 including any Fusion header to change the default. Example: 57 </p> 58<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">FUSION_MAX_MAP_SIZE</span> <span class="number">20</span> 59</pre> 60<h6> 61<a name="fusion.container.generation.functions.make_map.h2"></a> 62 <span class="phrase"><a name="fusion.container.generation.functions.make_map.parameters"></a></span><a class="link" href="make_map.html#fusion.container.generation.functions.make_map.parameters">Parameters</a> 63 </h6> 64<div class="informaltable"><table class="table"> 65<colgroup> 66<col> 67<col> 68<col> 69</colgroup> 70<thead><tr> 71<th> 72 <p> 73 Parameter 74 </p> 75 </th> 76<th> 77 <p> 78 Requirement 79 </p> 80 </th> 81<th> 82 <p> 83 Description 84 </p> 85 </th> 86</tr></thead> 87<tbody> 88<tr> 89<td> 90 <p> 91 <code class="computeroutput"><span class="identifier">K0</span><span class="special">,</span> 92 <span class="identifier">K1</span><span class="special">,...</span> 93 <span class="identifier">KN</span></code> 94 </p> 95 </td> 96<td> 97 <p> 98 The key types 99 </p> 100 </td> 101<td> 102 <p> 103 Keys associated with <code class="computeroutput"><span class="identifier">x0</span><span class="special">,</span> <span class="identifier">x1</span><span class="special">,...</span> <span class="identifier">xN</span></code> 104 </p> 105 </td> 106</tr> 107<tr> 108<td> 109 <p> 110 <code class="computeroutput"><span class="identifier">x0</span><span class="special">,</span> 111 <span class="identifier">x1</span><span class="special">,...</span> 112 <span class="identifier">xN</span></code> 113 </p> 114 </td> 115<td> 116 <p> 117 Instances of <code class="computeroutput"><span class="identifier">T0</span><span class="special">,</span> <span class="identifier">T1</span><span class="special">,...</span> <span class="identifier">TN</span></code> 118 </p> 119 </td> 120<td> 121 <p> 122 The arguments to <code class="computeroutput"><span class="identifier">make_map</span></code> 123 </p> 124 </td> 125</tr> 126</tbody> 127</table></div> 128<h6> 129<a name="fusion.container.generation.functions.make_map.h3"></a> 130 <span class="phrase"><a name="fusion.container.generation.functions.make_map.expression_semantics"></a></span><a class="link" href="make_map.html#fusion.container.generation.functions.make_map.expression_semantics">Expression 131 Semantics</a> 132 </h6> 133<pre class="programlisting"><span class="identifier">make_map</span><span class="special"><</span><span class="identifier">K0</span><span class="special">,</span> <span class="identifier">K1</span><span class="special">,...</span> <span class="identifier">KN</span><span class="special">>(</span><span class="identifier">x0</span><span class="special">,</span> <span class="identifier">x1</span><span class="special">,...</span> <span class="identifier">xN</span><span class="special">);</span> 134</pre> 135<p> 136 <span class="bold"><strong>Return type</strong></span>: <a class="link" href="../metafunctions/make_map.html" title="make_map"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">make_map</span></code></a><code class="computeroutput"><span class="special"><</span><span class="identifier">K0</span><span class="special">,</span> <span class="identifier">K0</span><span class="special">,...</span> <span class="identifier">KN</span><span class="special">,</span> <span class="identifier">T0</span><span class="special">,</span> <span class="identifier">T1</span><span class="special">,...</span> <span class="identifier">TN</span><span class="special">>::</span><span class="identifier">type</span></code> 137 </p> 138<p> 139 <span class="bold"><strong>Semantics</strong></span>: Create a <a class="link" href="../../map.html" title="map"><code class="computeroutput"><span class="identifier">map</span></code></a> from <code class="computeroutput"><span class="identifier">K0</span><span class="special">,</span> <span class="identifier">K1</span><span class="special">,...</span> <span class="identifier">KN</span></code> 140 keys and <code class="computeroutput"><span class="identifier">x0</span><span class="special">,</span> 141 <span class="identifier">x1</span><span class="special">,...</span> 142 <span class="identifier">xN</span></code> data. 143 </p> 144<p> 145 <span class="bold"><strong>Precondition</strong></span>: There may be no duplicate 146 key types. 147 </p> 148<h6> 149<a name="fusion.container.generation.functions.make_map.h4"></a> 150 <span class="phrase"><a name="fusion.container.generation.functions.make_map.header"></a></span><a class="link" href="make_map.html#fusion.container.generation.functions.make_map.header">Header</a> 151 </h6> 152<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">container</span><span class="special">/</span><span class="identifier">generation</span><span class="special">/</span><span class="identifier">make_map</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 153<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">make_map</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 154</pre> 155<h6> 156<a name="fusion.container.generation.functions.make_map.h5"></a> 157 <span class="phrase"><a name="fusion.container.generation.functions.make_map.example"></a></span><a class="link" href="make_map.html#fusion.container.generation.functions.make_map.example">Example</a> 158 </h6> 159<pre class="programlisting"><span class="identifier">make_map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">double</span><span class="special">>(</span><span class="char">'X'</span><span class="special">,</span> <span class="string">"Men"</span><span class="special">)</span> 160</pre> 161<h6> 162<a name="fusion.container.generation.functions.make_map.h6"></a> 163 <span class="phrase"><a name="fusion.container.generation.functions.make_map.see_also"></a></span><a class="link" href="make_map.html#fusion.container.generation.functions.make_map.see_also">See 164 also</a> 165 </h6> 166<p> 167 <a class="link" href="../../../notes.html#fusion.notes.reference_wrappers"><code class="computeroutput"><span class="identifier">Reference</span> 168 <span class="identifier">Wrappers</span></code></a>, <a class="link" href="../../../support/pair.html" title="pair"><code class="computeroutput"><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">pair</span></code></a> 169 </p> 170</div> 171<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 172<td align="left"></td> 173<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman, 174 Dan Marsden, Tobias Schwinger<p> 175 Distributed under the Boost Software License, Version 1.0. (See accompanying 176 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>) 177 </p> 178</div></td> 179</tr></table> 180<hr> 181<div class="spirit-nav"> 182<a accesskey="p" href="make_set.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../functions.html"><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="tiers.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 183</div> 184</body> 185</html> 186