+namespace {
+
+ // some helper functions for opt::print()
+
+ const char* on_off(bool b)
+ {
+ return b ? "on" : "off";
+ }
+
+ template <typename T>
+ const char* val_or_string(const T& val, const char* str, const T& deflt = 0)
+ {
+ static std::string res;
+ if (val != deflt) {
+ std::ostringstream oss;
+ oss << val;
+ res = oss.str();
+ } else {
+ res = str;
+ }
+ return res.c_str();
+ }
+
+} // namespace
+