3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>Complete instantiation scheme
</title>
5 <link rel=
"stylesheet" href=
"../../boostbook.css" type=
"text/css">
6 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.77.1">
7 <link rel=
"home" href=
"../../index.html" title=
"Chapter 1. Boost.Bimap">
8 <link rel=
"up" href=
"../the_tutorial.html" title=
"The tutorial">
9 <link rel=
"prev" href=
"additional_information.html" title=
"Additional information">
10 <link rel=
"next" href=
"../bimap_and_boost.html" title=
"Bimap and Boost">
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>
22 <div class=
"spirit-nav">
23 <a accesskey=
"p" href=
"additional_information.html"><img src=
"../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../the_tutorial.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=
"../bimap_and_boost.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>
25 <div class=
"section boost_bimap_the_tutorial_complete_instantiation_scheme">
26 <div class=
"titlepage"><div><div><h3 class=
"title">
27 <a name=
"boost_bimap.the_tutorial.complete_instantiation_scheme"></a><a class=
"link" href=
"complete_instantiation_scheme.html" title=
"Complete instantiation scheme">Complete
28 instantiation scheme
</a>
29 </h3></div></div></div>
31 To summarize, this is the complete instantiation scheme.
33 <pre class=
"programlisting"><span class=
"keyword">typedef
</span> <span class=
"identifier">bimap
</span>
34 <span class=
"special"><</span>
35 <span class=
"identifier">LeftCollectionType
</span><span class=
"special">,
</span> <span class=
"identifier">RightCollectionType
</span>
37 <span class=
"special">[
</span> <span class=
"special">,
</span> <span class=
"identifier">SetTypeOfRelation
</span> <span class=
"special">]
</span> <span class=
"comment">// Default to left_based
</span>
38 <span class=
"special">[
</span> <span class=
"special">,
</span> <span class=
"identifier">with_info
</span><span class=
"special"><</span> <span class=
"identifier">Info
</span> <span class=
"special">></span> <span class=
"special">]
</span> <span class=
"comment">// Default to no info
</span>
39 <span class=
"special">[
</span> <span class=
"special">,
</span> <span class=
"identifier">Allocator
</span> <span class=
"special">]
</span> <span class=
"comment">// Default to std::allocator
<></span>
41 <span class=
"special">></span> <span class=
"identifier">bm
</span><span class=
"special">;
</span>
44 <code class=
"computeroutput"><span class=
"special">{
</span><span class=
"identifier">Side
</span><span class=
"special">}
</span><span class=
"identifier">CollectionType
</span></code>
45 can directly be a type. This defaults to
<code class=
"computeroutput"><span class=
"identifier">set_of
</span><span class=
"special"><</span><span class=
"identifier">Type
</span><span class=
"special">></span></code>, or can be a
<code class=
"computeroutput"><span class=
"special">{
</span><span class=
"identifier">CollectionType
</span><span class=
"special">}
</span><span class=
"identifier">_of
</span><span class=
"special"><</span><span class=
"identifier">Type
</span><span class=
"special">></span></code>
46 specification. Additionally, the type of this two parameters can be tagged
47 to specify user defined names instead of the usual
<code class=
"computeroutput"><span class=
"identifier">member_at
</span><span class=
"special">::-
</span><span class=
"identifier">Side
</span><span class=
"special">-
</span></code> tags.
50 The possible way to use the first parameter are:
52 <pre class=
"programlisting"><span class=
"identifier">bimap
</span><span class=
"special"><</span> <span class=
"identifier">Type
</span><span class=
"special">,
</span> <span class=
"identifier">R
</span> <span class=
"special">></span>
54 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
56 Left type:
<code class=
"computeroutput"><span class=
"identifier">Type
</span></code>
59 Left collection type:
<code class=
"computeroutput"><span class=
"identifier">set_of
</span><span class=
"special"><</span> <span class=
"identifier">Type
</span>
60 <span class=
"special">></span></code>
63 Left tag:
<code class=
"computeroutput"><span class=
"identifier">member_at
</span><span class=
"special">::
</span><span class=
"identifier">left
</span></code>
66 <pre class=
"programlisting"><span class=
"identifier">bimap
</span><span class=
"special"><</span> <span class=
"special">{
</span><span class=
"identifier">CollectionType
</span><span class=
"special">}
</span><span class=
"identifier">_of
</span><span class=
"special"><</span> <span class=
"identifier">Type
</span> <span class=
"special">>,
</span> <span class=
"identifier">R
</span> <span class=
"special">></span>
68 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
70 Left type:
<code class=
"computeroutput"><span class=
"identifier">Type
</span></code>
73 Left collection type:
<code class=
"computeroutput"><span class=
"special">{
</span><span class=
"identifier">CollectionType
</span><span class=
"special">}
</span><span class=
"identifier">_of
</span><span class=
"special"><</span> <span class=
"identifier">LeftType
</span> <span class=
"special">></span></code>
76 Left tag:
<code class=
"computeroutput"><span class=
"identifier">member_at
</span><span class=
"special">::
</span><span class=
"identifier">left
</span></code>
79 <pre class=
"programlisting"><span class=
"identifier">bimap
</span><span class=
"special"><</span> <span class=
"identifier">tagged
</span><span class=
"special"><</span> <span class=
"identifier">Type
</span><span class=
"special">,
</span> <span class=
"identifier">Tag
</span> <span class=
"special">>,
</span> <span class=
"identifier">R
</span> <span class=
"special">></span>
81 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
83 Left type:
<code class=
"computeroutput"><span class=
"identifier">Type
</span></code>
86 Left collection type:
<code class=
"computeroutput"><span class=
"identifier">set_of
</span><span class=
"special"><</span> <span class=
"identifier">LeftType
</span>
87 <span class=
"special">></span></code>
90 Left tag:
<code class=
"computeroutput"><span class=
"identifier">Tag
</span></code>
93 <pre class=
"programlisting"><span class=
"identifier">bimap
</span><span class=
"special"><</span> <span class=
"special">{
</span><span class=
"identifier">CollectionType
</span><span class=
"special">}
</span><span class=
"identifier">_of
</span><span class=
"special"><</span> <span class=
"identifier">tagged
</span><span class=
"special"><</span> <span class=
"identifier">Type
</span><span class=
"special">,
</span> <span class=
"identifier">Tag
</span> <span class=
"special">></span> <span class=
"special">>,
</span> <span class=
"identifier">R
</span> <span class=
"special">></span>
95 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
97 Left type:
<code class=
"computeroutput"><span class=
"identifier">Type
</span></code>
100 Left collection type:
<code class=
"computeroutput"><span class=
"special">{
</span><span class=
"identifier">CollectionType
</span><span class=
"special">}
</span><span class=
"identifier">_of
</span><span class=
"special"><</span> <span class=
"identifier">LeftType
</span> <span class=
"special">></span></code>
102 <li class=
"listitem">
103 Left tag:
<code class=
"computeroutput"><span class=
"identifier">Tag
</span></code>
107 The same options are available for the second parameter.
110 The last three parameters are used to specify the collection type of the
111 relation, the information member and the allocator type.
114 If you want to specify a custom allocator type while relying on the default
115 value of CollectionTypeOfRelation, you can do so by simply writing
<code class=
"computeroutput"><span class=
"identifier">bimap
</span><span class=
"special"><</span><span class=
"identifier">LeftKeyType
</span><span class=
"special">,
</span>
116 <span class=
"identifier">RightKeyType
</span><span class=
"special">,
</span>
117 <span class=
"identifier">Allocator
</span><span class=
"special">></span></code>.
118 Boost.Bimap's internal machinery detects that the third parameter in this
119 case does not refer to the relation type but rather to an allocator.
122 The following are the possible ways of instantiating the last three parameters
123 of a bimap. You can ignore some of the parameter but the order must be respected.
125 <pre class=
"programlisting"><span class=
"identifier">bimap
</span><span class=
"special"><</span> <span class=
"identifier">L
</span><span class=
"special">,
</span> <span class=
"identifier">R
</span> <span class=
"special">></span>
127 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
128 <li class=
"listitem">
129 set_of_relation_type: based on the left key type
131 <li class=
"listitem">
134 <li class=
"listitem">
135 allocator: std::allocator
138 <pre class=
"programlisting"><span class=
"identifier">bimap
</span><span class=
"special"><</span> <span class=
"identifier">L
</span><span class=
"special">,
</span> <span class=
"identifier">R
</span> <span class=
"special">,
</span><span class=
"identifier">SetOfRelationType
</span><span class=
"special">></span>
140 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
141 <li class=
"listitem">
142 set_of_relation_type: SetOfRelationType
144 <li class=
"listitem">
147 <li class=
"listitem">
148 allocator: std::allocator
151 <pre class=
"programlisting"><span class=
"identifier">bimap
</span><span class=
"special"><</span> <span class=
"identifier">L
</span><span class=
"special">,
</span> <span class=
"identifier">R
</span> <span class=
"special">,
</span> <span class=
"identifier">SetOfRelationType
</span><span class=
"special">,
</span> <span class=
"identifier">with_info
</span><span class=
"special"><</span><span class=
"identifier">Info
</span><span class=
"special">></span> <span class=
"special">></span>
153 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
154 <li class=
"listitem">
155 set_of_relation_type: SetOfRelationType
157 <li class=
"listitem">
160 <li class=
"listitem">
161 allocator: std::allocator
164 <pre class=
"programlisting"><span class=
"identifier">bimap
</span><span class=
"special"><</span> <span class=
"identifier">L
</span><span class=
"special">,
</span> <span class=
"identifier">R
</span> <span class=
"special">,
</span> <span class=
"identifier">SetOfRelationType
</span><span class=
"special">,
</span> <span class=
"identifier">with_info
</span><span class=
"special"><</span><span class=
"identifier">Info
</span><span class=
"special">>,
</span> <span class=
"identifier">Allocator
</span><span class=
"special">></span>
166 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
167 <li class=
"listitem">
168 set_of_relation_type: SetOfRelationType
170 <li class=
"listitem">
173 <li class=
"listitem">
177 <pre class=
"programlisting"><span class=
"identifier">bimap
</span><span class=
"special"><</span> <span class=
"identifier">L
</span><span class=
"special">,
</span> <span class=
"identifier">R
</span> <span class=
"special">,
</span> <span class=
"identifier">SetOfRelationType
</span><span class=
"special">,
</span> <span class=
"identifier">Allocator
</span><span class=
"special">></span>
179 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
180 <li class=
"listitem">
181 set_of_relation_type: SetOfRelationType
183 <li class=
"listitem">
186 <li class=
"listitem">
190 <pre class=
"programlisting"><span class=
"identifier">bimap
</span><span class=
"special"><</span> <span class=
"identifier">L
</span><span class=
"special">,
</span> <span class=
"identifier">R
</span> <span class=
"special">,
</span> <span class=
"identifier">with_info
</span><span class=
"special"><</span><span class=
"identifier">Info
</span><span class=
"special">></span> <span class=
"special">></span>
192 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
193 <li class=
"listitem">
194 set_of_relation_type: based on the left key type
196 <li class=
"listitem">
199 <li class=
"listitem">
200 allocator: std::allocator
203 <pre class=
"programlisting"><span class=
"identifier">bimap
</span><span class=
"special"><</span> <span class=
"identifier">L
</span><span class=
"special">,
</span> <span class=
"identifier">R
</span> <span class=
"special">,
</span> <span class=
"identifier">with_info
</span><span class=
"special"><</span><span class=
"identifier">Info
</span><span class=
"special">>,
</span> <span class=
"identifier">Allocator
</span><span class=
"special">></span>
205 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
206 <li class=
"listitem">
207 set_of_relation_type: based on the left key type
209 <li class=
"listitem">
213 <pre class=
"programlisting"><span class=
"identifier">bimap
</span><span class=
"special"><</span> <span class=
"identifier">L
</span><span class=
"special">,
</span> <span class=
"identifier">R
</span> <span class=
"special">,
</span> <span class=
"identifier">Allocator
</span><span class=
"special">></span>
215 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
216 <li class=
"listitem">
217 set_of_relation_type: based on the left key type
219 <li class=
"listitem">
222 <li class=
"listitem">
227 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
228 <td align=
"left"></td>
229 <td align=
"right"><div class=
"copyright-footer">Copyright
© 2006-
2012 Matias Capeletto
<p>
230 Distributed under the Boost Software License, Version
1.0. (See accompanying
231 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>)
236 <div class=
"spirit-nav">
237 <a accesskey=
"p" href=
"additional_information.html"><img src=
"../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../the_tutorial.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=
"../bimap_and_boost.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>