]> git.sesse.net Git - xml-template/blobdiff - c++0x/simple.cpp
Make the C++0x syntax a lot more concise using initializer lists.
[xml-template] / c++0x / simple.cpp
index 36766f80c1ffa4acb01e647a7dd723691e6a0a0f..5ac223d09f72eda03769dd1d1bef78b964cf8de3 100644 (file)
@@ -6,10 +6,11 @@ using namespace std;
 
 int main(int argc, char **argv)
 {
-       unordered_map<string, Directive*> master_map;
-       master_map.insert(make_pair("title", new Replace("A very basic example")));
-       master_map.insert(make_pair("#hello", new Replace("Hello world!")));
+       Substitute master_directive = {
+               make_pair("title", new Replace("A very basic example")),
+               make_pair("#hello", new Replace("Hello world!")),
+       };
 
-       process_file("../xml/simple.xml", argv[1], new Substitute(master_map));
+       process_file("../xml/simple.xml", argv[1], &master_directive);
        return(0);
 }