|
|
@@ -83,7 +83,23 @@ struct conversion_helper<std::vector<T>> : conversion_helper<T> {
|
|
|
std::vector<T> operator()(std::vector<std::string> const & data) const {
|
|
|
std::vector<T> rval;
|
|
|
for (auto & str : data) {
|
|
|
- rval.emplace_back((*this)(str));
|
|
|
+ rval.push_back((*this)(str));
|
|
|
+ }
|
|
|
+ return rval;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+template <typename T>
|
|
|
+struct conversion_helper<std::map<std::string, T>> : conversion_helper<T> {
|
|
|
+ using conversion_helper<T>::operator();
|
|
|
+ std::map<std::string, T> operator()(std::vector<std::string> const & data) const {
|
|
|
+ std::map<std::string, T> rval;
|
|
|
+ for (auto & str : data) {
|
|
|
+ size_t pos = str.find('=');
|
|
|
+ if (pos == std::string::npos) {
|
|
|
+ throw std::invalid_argument("expected argument of the form key=value, got " + str);
|
|
|
+ }
|
|
|
+ rval.emplace(str.substr(0, pos), (*this)(str.substr(pos + 1)));
|
|
|
}
|
|
|
return rval;
|
|
|
}
|