| 100 | |
| 101 | template <typename T, typename V> |
| 102 | T cmd_getval_or(const cmdmap_t& cmdmap, std::string_view k, |
| 103 | const V& defval) |
| 104 | { |
| 105 | auto found = cmdmap.find(k); |
| 106 | if (found == cmdmap.cend()) { |
| 107 | return T(defval); |
| 108 | } |
| 109 | try { |
| 110 | return boost::get<T>(found->second); |
| 111 | } catch (boost::bad_get&) { |
| 112 | throw bad_cmd_get(k, cmdmap); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * with default, to be used when the parameter type (which matches the type of the |
nothing calls this directly
no test coverage detected