3 #include "stg/common.h"
4 #include "stg/optional.h"
14 void MaybeSet(const std::map<std::string, std::string> & options, const std::string & name, STG::Optional<T> & res)
16 std::map<std::string, std::string>::const_iterator it(options.find(name));
17 if (it == options.end())
20 if (str2x(it->second, value) < 0)
25 template <typename T, typename F>
27 void MaybeSet(const std::map<std::string, std::string> & options, const std::string & name, T & res, F conv)
29 std::map<std::string, std::string>::const_iterator it(options.find(name));
30 if (it == options.end())
32 conv(it->second, res);
37 void MaybeSet<std::string>(const std::map<std::string, std::string> & options, const std::string & name, STG::Optional<std::string> & res)
39 std::map<std::string, std::string>::const_iterator it(options.find(name));
40 if (it == options.end())