examples.qbk
7.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
[/license
Boost.Bimap
Copyright (c) 2006-2007 Matias Capeletto
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
]
[/ QuickBook Document version 1.4 ]
[section Examples]
[section Examples list]
In the folder [@../../example libs/bimap/example] you can find all the examples
used in bimap documentation. Here is a list of them:
[table Tutorial examples
[[Program ][Description ]]
[[[@../../example/simple_bimap.cpp
simple_bimap.cpp ]]
[Soccer world cup example ]]
[[[@../../example/tagged_simple_bimap.cpp
tagged_simple_bimap.cpp ]]
[Soccer world cup example using user defined names ]]
[[[@../../example/step_by_step.cpp
step_by_step.cpp ]]
[Basic example of the three views of bimap ]]
[[[@../../example/population_bimap.cpp
population_bimap.cpp ]]
[Countries populations, using `unordered_set_of` and `multiset_of` ]]
[[[@../../example/repetitions_counter.cpp
repetitions_counter.cpp ]]
[Word repetitions counter, using `unordered_set_of` and `list_of` ]]
[[[@../../example/mighty_bimap.cpp
mighty_bimap.cpp ]]
[Dictionary using `list_of_relation` ]]
[[[@../../example/user_defined_names.cpp
user_defined_names.cpp ]]
[Equivalence between code with tagged and untagged code ]]
[[[@../../example/standard_map_comparison.cpp
standard_map_comparison.cpp ]]
[Comparison between standard maps and bimap map views ]]
[[[@../../example/at_function_examples.cpp
at_function_examples.cpp ]]
[Functions `at(key)` and `operator[](key)` examples ]]
[[[@../../example/tutorial_modify_and_replace.cpp
tutorial_modify_and_replace.cpp ]]
[`modify` and `replace` examples ]]
[[[@../../example/tutorial_range.cpp
tutorial_range.cpp ]]
[`range()` tutorial ]]
[[[@../../example/tutorial_info_hook.cpp
tutorial_info_hook.cpp ]]
[Additional information hooking ]]
[[[@../../example/unconstrained_collection.cpp
unconstrained_collection.cpp ]]
[Using `unconstrained_set_of` collection type ]]
]
[table Bimap and Boost examples
[[Program ][Description ]]
[[[@../../example/bimap_and_boost/assign.cpp
assign.cpp ]]
[Bimap and Boost.Assign: Methods to insert elements ]]
[[[@../../example/bimap_and_boost/lambda.cpp
lambda.cpp ]]
[Bimap and Boost.Lambda: new lambda placeholders ]]
[[[@../../example/bimap_and_boost/property_map.cpp
property_map.cpp ]]
[Bimap and Boost.PropertyMap: PropertyMap support ]]
[[[@../../example/bimap_and_boost/range.cpp
range.cpp ]]
[Bimap and Boost.Range: Using bimaps in the new range framework ]]
[[[@../../example/bimap_and_boost/foreach.cpp
foreach.cpp ]]
[Bimap and Boost.Foreach: Iterating over bimaps ]]
[[[@../../example/bimap_and_boost/typeof.cpp
typeof.cpp ]]
[Bimap and Boost.Typeof: using BOOST_AUTO while we wait for C++0x ]]
[[[@../../example/bimap_and_boost/xpressive.cpp
xpressive.cpp ]]
[Bimap and Boost.Xpressive: Inserting elements in a bimap ]]
[[[@../../example/bimap_and_boost/serialization.cpp
serialization.cpp: ]]
[Bimap and Boost.Serialization: Load and save bimaps and iterators ]]
]
[table Boost.MultiIndex to Boost.Bimap path examples
[[Program ][Description ]]
[[[@../../example/mi_to_b_path/bidirectional_map.cpp
bidirectional_map.cpp ]]
[Boost.MultiIndex to Boost.Bimap path example ]]
[[[@../../example/mi_to_b_path/hashed_indices.cpp
hashed_indices.cpp ]]
[Boost.MultiIndex to Boost.Bimap path example ]]
[[[@../../example/mi_to_b_path/tagged_bidirectional_map.cpp
tagged_bidirectional_map.cpp ]]
[Boost.MultiIndex to Boost.Bimap path example ]]
]
[endsect]
[section Simple Bimap]
This is the example from the one minute tutorial section.
[@../../example/simple_bimap.cpp Go to source code]
[code_simple_bimap]
You can rewrite it using tags to gain readability.
[@../../example/tagged_simple_bimap.cpp Go to source code]
[import ../example/tagged_simple_bimap.cpp]
[code_tagged_simple_bimap]
[endsect]
[section Mighty Bimap]
This is the translator example from the tutorial.
In this example the collection type of relation is changed to allow the iteration
of the container.
[@../../example/mighty_bimap.cpp Go to source code]
[code_mighty_bimap]
[endsect]
[section MultiIndex to Bimap Path - Bidirectional Map]
This is example 4 in Boost.MultiIndex documentation.
[blurb
This example shows how to construct a bidirectional map with multi_index_container.
By a bidirectional map we mean a container of elements of
`std::pair<const FromType,const ToType>` such that no two elements exists with the
same first or second value (`std::map` only guarantees uniqueness of the first member).
Fast look-up is provided for both keys. The program features a tiny Spanish-English
dictionary with on-line query of words in both languages.
]
[heading Boost.MultiIndex]
[@../../example/mi_to_b_path/mi_bidirectional_map.cpp Go to source code]
[import ../example/mi_to_b_path/mi_bidirectional_map.cpp]
[code_mi_to_b_path_mi_bidirectional_map]
[heading Boost.Bimap]
[@../../example/mi_to_b_path/bidirectional_map.cpp Go to source code]
[import ../example/mi_to_b_path/bidirectional_map.cpp]
[code_mi_to_b_path_bidirectional_map]
Or better, using tags...
[@../../example/mi_to_b_path/tagged_bidirectional_map.cpp Go to source code]
[import ../example/mi_to_b_path/tagged_bidirectional_map.cpp]
[code_mi_to_b_path_tagged_bidirectional_map]
[endsect]
[section MultiIndex to Bimap Path - Hashed indices]
This is example 8 of Boost.MultiIndex.
[blurb
Hashed indices can be used as an alternative to ordered indices when fast look-up is needed and sorting
information is of no interest. The example features a word counter where duplicate entries are checked by
means of a hashed index.
]
[heading Boost.MultiIndex]
[@../../example/mi_to_b_path/mi_hashed_indices.cpp Go to source code]
[import ../example/mi_to_b_path/mi_hashed_indices.cpp]
[code_mi_to_b_path_mi_hashed_indices]
[heading Boost.Bimap]
[@../../example/mi_to_b_path/hashed_indices.cpp Go to source code]
[import ../example/mi_to_b_path/hashed_indices.cpp]
[code_mi_to_b_path_hashed_indices]
[endsect]
[endsect]