namespace lm { | |
namespace { | |
class SizeNotify { | |
public: | |
explicit SizeNotify(std::size_t &out) : behind_(out) {} | |
void operator()(const std::string &from) { | |
behind_ = util::ParseSize(from); | |
} | |
private: | |
std::size_t &behind_; | |
}; | |
} | |
boost::program_options::typed_value<std::string> *SizeOption(std::size_t &to, const char *default_value) { | |
return boost::program_options::value<std::string>()->notifier(SizeNotify(to))->default_value(default_value); | |
} | |
} // namespace lm | |