20 The map will store items of size `itemsize`. |
20 The map will store items of size `itemsize`. |
21 You can use the `CX_STORE_POINTERS` macro for `itemsize` to indicate that the map shall store |
21 You can use the `CX_STORE_POINTERS` macro for `itemsize` to indicate that the map shall store |
22 pointers instead of actual items. |
22 pointers instead of actual items. |
23 |
23 |
24 If you pass zero for the number of `buckets`, or use `cxHashMapSimple()`, |
24 If you pass zero for the number of `buckets`, or use `cxHashMapSimple()`, |
25 the map is initialized with a default of 16 buckets, otherwise the specified number of buckets is allocated. |
25 the map is initialized with a default of 16 buckets; otherwise the specified number of buckets is allocated. |
26 |
26 |
27 > If you want to lazy-initialize maps, you can use the global `cxEmptyMap` symbol as a placeholder instead of using a `NULL`-pointer. |
27 > If you want to lazy-initialize maps, you can use the global `cxEmptyMap` symbol as a placeholder instead of using a `NULL`-pointer. |
28 > While you *must not* insert elements into that map, you can safely access this map or create iterators. |
28 > While you *must not* insert elements into that map, you can safely access this map or create iterators. |
29 > This allows you to write clean code without checking for `NULL`-pointer everywhere. |
29 > This allows you to write clean code without checking for `NULL`-pointer everywhere. |
30 > You still need to make sure that the placeholder is replaced with an actual map before inserting elements. |
30 > You still need to make sure that the placeholder is replaced with an actual map before inserting elements. |
78 |
78 |
79 The above example illustrates basic operations with a map. |
79 The above example illustrates basic operations with a map. |
80 |
80 |
81 In the first part we add several entries to the map. |
81 In the first part we add several entries to the map. |
82 Then the example shows retrieval, updating, and removal of information. |
82 Then the example shows retrieval, updating, and removal of information. |
83 The last part shows how to iterate over the pairs of the map and how to recover the string from the key. |
83 The last part shows how to iterate over the pairs inside the map and how to recover the string from the key. |
84 |
84 |
85 In real-world situations, however, it is quite unlikely that you will use a map to store string literals. |
85 In real-world situations, however, it is quite unlikely that you will use a map to store string literals. |
86 The next example shows a more realistic program, where it is necessary to store strings based on user input. |
86 The next example shows a more realistic program, where it is necessary to store strings based on user input. |
87 |
87 |
88 ```C |
88 ```C |