00001 #include <boost/program_options.hpp>
00002 #include "util/usage.hh"
00003
00004 namespace lm {
00005
00006 namespace {
00007 class SizeNotify {
00008 public:
00009 explicit SizeNotify(std::size_t &out) : behind_(out) {}
00010
00011 void operator()(const std::string &from) {
00012 behind_ = util::ParseSize(from);
00013 }
00014
00015 private:
00016 std::size_t &behind_;
00017 };
00018 }
00019
00020 boost::program_options::typed_value<std::string> *SizeOption(std::size_t &to, const char *default_value) {
00021 return boost::program_options::value<std::string>()->notifier(SizeNotify(to))->default_value(default_value);
00022 }
00023
00024 }