Skip to content

Commit

Permalink
Update How-To-Emit-YAML.md (jbeder#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauljurczak authored Sep 21, 2023
1 parent d046eea commit 37f1b8b
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions docs/How-To-Emit-YAML.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,9 @@ produces
We overload `operator <<` for `std::vector`, `std::list`, and `std::map`, so you can write stuff like:

```cpp
std::vector <int> squares;
squares.push_back(1);
squares.push_back(4);
squares.push_back(9);
squares.push_back(16);
std::vector <int> squares = {1, 4, 9, 16};

std::map <std::string, int> ages;
ages["Daniel"] = 26;
ages["Jesse"] = 24;
std::map <std::string, int> ages = {{"Daniel", 26}, {"Jesse", 24}};

YAML::Emitter out;
out << YAML::BeginSeq;
Expand Down Expand Up @@ -227,4 +221,4 @@ assert(out.good());
out << YAML::Key;
assert(!out.good());
std::cout << "Emitter error: " << out.GetLastError() << "\n";
```
```

0 comments on commit 37f1b8b

Please sign in to comment.