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