diff --git a/docs/How-To-Emit-YAML.md b/docs/How-To-Emit-YAML.md index 934070199..f28fcbe0e 100644 --- a/docs/How-To-Emit-YAML.md +++ b/docs/How-To-Emit-YAML.md @@ -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 squares; -squares.push_back(1); -squares.push_back(4); -squares.push_back(9); -squares.push_back(16); +std::vector squares = {1, 4, 9, 16}; -std::map ages; -ages["Daniel"] = 26; -ages["Jesse"] = 24; +std::map ages = {{"Daniel", 26}, {"Jesse", 24}}; YAML::Emitter out; out << YAML::BeginSeq; @@ -227,4 +221,4 @@ assert(out.good()); out << YAML::Key; assert(!out.good()); std::cout << "Emitter error: " << out.GetLastError() << "\n"; -``` \ No newline at end of file +```