summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-10-04 13:37:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-10-04 13:37:47 +0200
commit8ed3cbc6f7a99713e6ea581c95e5a991ef829979 (patch)
treec51755e2c2fa098637632bc03903971cd186b646
parent7aa9ee40d07ed48699fe91d6e1ee2fefbb6c1bfc (diff)
Add a parser for std::set
-rw-r--r--cli/runtime-source.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/runtime-source.cxx b/cli/runtime-source.cxx
index 13718b7..1be8f13 100644
--- a/cli/runtime-source.cxx
+++ b/cli/runtime-source.cxx
@@ -13,6 +13,7 @@ generate_runtime_source (context& ctx)
ostream& os (ctx.os);
os << "#include <map>" << endl
+ << "#include <set>" << endl
<< "#include <string>" << endl
<< "#include <vector>" << endl
<< "#include <ostream>" << endl
@@ -165,6 +166,21 @@ generate_runtime_source (context& ctx)
<< "}"
<< "};";
+ // parser<std::set<X>>
+ //
+ os << "template <typename X>" << endl
+ << "struct parser<std::set<X> >"
+ << "{"
+ << "static int" << endl
+ << "parse (std::set<X>& s, char** argv, int n)"
+ << "{"
+ << "X x;"
+ << "int i (parser<X>::parse (x, argv, n));"
+ << "s.insert (x);"
+ << "return i;"
+ << "}"
+ << "};";
+
// parser<std::map<K,V>>
//
os << "template <typename K, typename V>" << endl