Commit a7c57cea authored by neverlord's avatar neverlord

bugfix

parent b88d7229
...@@ -112,6 +112,12 @@ inline bool found_key(Iterator& i, Container& cont, Key&& key) ...@@ -112,6 +112,12 @@ inline bool found_key(Iterator& i, Container& cont, Key&& key)
return (i = cont.find(std::forward<Key>(key))) != cont.end(); return (i = cont.find(std::forward<Key>(key))) != cont.end();
} }
template<typename F, typename S>
any_tuple to_tuple(std::pair<F, S> const& p)
{
return make_tuple(p.first, p.second);
}
struct match_helper struct match_helper
{ {
any_tuple tup; any_tuple tup;
...@@ -127,9 +133,25 @@ struct match_helper ...@@ -127,9 +133,25 @@ struct match_helper
template<typename F, typename S> template<typename F, typename S>
match_helper match(std::pair<F, S> const& what) match_helper match(std::pair<F, S> const& what)
{ {
return {make_tuple(what.first, what.second)}; return {to_tuple(what)};
} }
template<class Container>
struct match_each_helper
{
Container const& args;
template<typename... Args>
void operator()(partial_function&& pf, Args&&... args)
{
partial_function tmp;
tmp.splice(std::move(pf), std::forward<Args>(args)...);
for (auto& arg : args)
{
tmp(to_tuple(arg));
}
}
};
void usage(char const* argv0) void usage(char const* argv0)
{ {
cout << "usage: " << split(argv0, '/').back() << " " cout << "usage: " << split(argv0, '/').back() << " "
...@@ -170,12 +192,6 @@ int main(int argc, char** argv) ...@@ -170,12 +192,6 @@ int main(int argc, char** argv)
cerr << "unknown scheduler: " << sched << endl; cerr << "unknown scheduler: " << sched << endl;
exit(1); exit(1);
} }
},
on_arg_match >> [&](std::string const& key, std::string const&)
{
cerr << "unknown key: \"" << key << "\"" << endl;
usage(argv[0]);
exit(2);
} }
); );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment