You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,8 @@ It conforms to the following format:
16
16
- every entry exists on a single line and multiline is not supported
17
17
18
18
19
-
```
19
+
```INI
20
+
; comment
20
21
[section]
21
22
key = value
22
23
```
@@ -178,7 +179,7 @@ std::string& value = ini["section"]["key"];
178
179
std::string value = ini.get("section").get("key");
179
180
```
180
181
181
-
The difference between `[]` and `get()` operations is that `[]` returns a reference to **real** data (that you may modify) and creates a new item automatically if it does not yet exist, whereas `get()` returns a **copy** of the data and does not create new items in the structure. Use `has()` before doing any operations with `[]` if you wish to avoid altering the structure.
182
+
The difference between `[]` and `get()` operations is that `[]` returns a reference to **real** data (that you may modify) and creates a new item automatically if one does not already exist, whereas `get()` returns a **copy** of the data and doesn't create new items in the structure. Use `has()` before doing any operations with `[]` if you wish to avoid altering the structure.
182
183
183
184
You may combine usage of `[]` and `get()`.
184
185
@@ -306,7 +307,7 @@ for (auto const& it : ini)
306
307
for (auto const& it2 : collection)
307
308
{
308
309
auto const& key = it2.first;
309
-
ini[section][key] = "banana";
310
+
ini[section][key] = "banana"; // O(1) because hashmaps
0 commit comments