Skip to content

Commit 1f3d971

Browse files
committed
Merge branch 'master' of https://github.com/pulzed/mINI
2 parents fbfc832 + 17e90a2 commit 1f3d971

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ It conforms to the following format:
1616
- every entry exists on a single line and multiline is not supported
1717

1818

19-
```
19+
```INI
20+
; comment
2021
[section]
2122
key = value
2223
```
@@ -178,7 +179,7 @@ std::string& value = ini["section"]["key"];
178179
std::string value = ini.get("section").get("key");
179180
```
180181

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.
182183

183184
You may combine usage of `[]` and `get()`.
184185

@@ -306,7 +307,7 @@ for (auto const& it : ini)
306307
for (auto const& it2 : collection)
307308
{
308309
auto const& key = it2.first;
309-
ini[section][key] = "banana";
310+
ini[section][key] = "banana"; // O(1) because hashmaps
310311
}
311312
}
312313
```

0 commit comments

Comments
 (0)